MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which command is used to view the structure of the table?
A
SELECT * FROM <tableName>;
B
DESC <tableName>;
C
CREATE TABLE
D
ALTER TABLE
Explanation: 

Detailed explanation-1: -DESCRIBE means to show the information in detail. Since we have tables in MySQL, so we will use the DESCRIBE command to show the structure of our table, such as column names, constraints on column names, etc. The DESC command is a short form of the DESCRIBE command.

Detailed explanation-2: -So desc or describe command shows the structure of table which include name of the column, data-type of column and the nullability which means, that column can contain null values or not.

Detailed explanation-3: -As SQL is case insensitive we can write DESC command as desc as well. This is the simple syntax to retrieve the structure of the table. DESC | DESCRIBE [TableName | ViewName]; Let us take a simple example of table Student and retrieve its structure using DESC in SQL.

Detailed explanation-4: -Using the “DESC table name” command, you can check the details of the table you created.

Detailed explanation-5: -The DESC command is used to sort the data returned in descending order.

There is 1 question to complete.