MoL Chapter 5 Lab

From SQLZOO
Jump to navigation Jump to search
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,column_name,column_type
FROM information_schema.columns WHERE column_name = 'num'
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
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'