'Sql query to return column name, data type, data length, if a column is null

I have the following query:

SELECT column_name,
   data_type
   date_length
FROM   information_schema.columns
WHERE  table_schema = ’bookidz_ro_dev’
AND    table_name = ’rack_level’;

And I get this error: #1054 - Unknown column '’bookidz_ro_dev’' in 'where clause' even though the db name is correct and so is the table name.



Solution 1:[1]

Looks like You are using wrong quotations, try it with correct one:

SELECT column_name,
   data_type
   date_length
FROM   information_schema.columns
WHERE  table_schema = 'bookidz_ro_dev'
AND    table_name = 'rack_level';

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MatejG