Which query will give the table structure with column definitions in SQL?
DESCRIBE tableName
Check MySQL describe command
It depends from the database you use. Here is an incomplete list:
.schema table_name
\d table_name
sp_columns table_name
for only columns)describe table_name
describe table_name
(or show columns from table_name
for only columns)sp_help tablename in sql server -- sp_help [ [ @objname = ] 'name' ]
desc tablename in oracle -- DESCRIBE { table-Name | view-Name }
Sql server
DECLARE @tableName nvarchar(100)
SET @tableName = N'members' -- change with table name
SELECT
[column].*,
COLUMNPROPERTY(object_id([column].[TABLE_NAME]), [column].[COLUMN_NAME], 'IsIdentity') AS [identity]
FROM
INFORMATION_SCHEMA.COLUMNS [column]
WHERE
[column].[Table_Name] = @tableName
For SQL, use the Keyword 'sp_help'
This depends on your database vendor. Mostly it's the "information schema" you should Google for (applies to MySQL, MSSQL and perhaps others).