MoL Chapter 7 Lab

From SQLZoo
Use the MySQL DESCRIBE command to examine the table GOAL
DESCRIBE goal
What tables in the manning database has a column called name. In your answer only show the table name.
SELECT table_name
FROM information_schema.columns
WHERE 
AND table_schema = 'manning'
SELECT table_name
FROM information_schema.columns WHERE column_name = 'name'
AND table_schema = 'manning'


Find the table name, column name, and column type for all columns in the manning database which have a decimal type. Hint: use like on the type to ignore the precision information.
SELECT table_name,column_name,column_type
FROM information_schema.columns
WHERE 
AND table_schema = 'manning'
SELECT table_name,column_name,column_type
FROM information_schema.columns WHERE column_type like 'decimal%'
AND table_schema = 'manning'


Find the table name, column name, and column type for all columns in the manning database which have a varchar type, and which below to a table with a name beginning with a "w".
SELECT table_name,column_name,column_type
FROM information_schema.columns WHERE column_type like 'varchar%'
and table_name like 'w%'
AND table_schema = 'manning'
Find the table name, column name, and column type for all columns in the manning database which have a precision of 50. Hint: use two % signs in a like.
SELECT table_name,column_name,column_type
FROM information_schema.columns WHERE column_type like '%(50%'
AND table_schema = 'manning'

Find all the table names in the manning database, displayed in reverse alphabetical order, and limited to the first 5 table names.
SELECT column_name
FROM information_schema.columns 
WHERE table_schema = 'manning'
ORDER BY column_name DESC
LIMIT 5
DataWars, Data Science Practice Projects - LogoDataWars: Practice Data Science/Analysis with +100 Real Life Projects
  • Your server today is: Laa-Laa