Page 337 - IT 402 v2.0 class 10
P. 337
Now, display the item has maximum cost. The following command will show the desired output:
SE L E CT M AX ( CO ST ) F RO M O F F I CE ;
+ - - - - - - - - - - - +
| M AX ( CO ST ) |
+ - - - - - - - - - - - +
| 1 2 0 |
+ - - - - - - - - - - - +
Now, display the item has minimum cost. The following command will show the desired output:
SE L E CT M I N( CO ST ) F RO M O F F I CE ;
+ - - - - - - - - - - - +
| M I N( CO ST ) |
+ - - - - - - - - - - - +
| 1 0 |
+ - - - - - - - - - - - +
DESCRIBING A TABLE
The DESC command is used to show the structure of a database table. The syntax of the DESC command is
as follows:
D E SC tab le_ name;
For example,
D E SC Stu d ent;
Preceding query will show the following output:
+ - - - - - - - - - - - + - - - - - - - - - - + - - - - - - + - - - - - + - - - - - - - - - + - - - - - - - +
| F ield | T y p e | Nu ll | K ey | D ef au lt | E x tr a |
+ - - - - - - - - - - - + - - - - - - - - - - + - - - - - - + - - - - - + - - - - - - - - - + - - - - - - - +
| Stu d entI D | int | Y E S | | NU L L | |
| F ir stName | char ( 3 0 ) | Y E S | | NU L L | |
| L astName | char ( 3 0 ) | Y E S | | NU L L | |
| M ar k s | int | Y E S | | NU L L | |
+ - - - - - - - - - - - + - - - - - - - - - - + - - - - - - + - - - - - + - - - - - - - - - + - - - - - - - +
DELETING A TABLE
The DROP TABLE command is used to delete a table from a database. The syntax of the DROP TABLE command
is as follows:
DROP TABLE table_name;
For example,
DROP TABLE Student;
Once the preceding command is executed, the Student table will be deleted.
Introduction to MySQL 335

