SQL Data Control Language

Data Control Language decides to whom should (which user) permit access privileges.

GRANT and REVOKE are the commands of DCL.

GRANT: It gives privileges to user.

REVOKE: It takes back privileges from granted user.

Data Query Language

Data Query Language does not make any changes in database. Neither schema level nor data level.

SELECT is a command of DQL.

SELECT: Retrieves data /records from table.

Syntax:

SELECT Column_1, Column 2, …..

FROM  Table_name

[WHERE condition];

Example:

  1. Select Student_id , Student_name

From Student

Where Student_id=’10’;

  1. Select Student_id , Student_name

From Student;

Syntax:

SELECT *

FROM  Table_name

[WHERE condition];

Example:

Select  *

From  Student

where Student_id=’10’;

  • This query retrieves single record with all its attributes/columns.
  • ‘* ‘Indicates all the fields/attributes/columns in the table.
  • Where condition is specified for a particular record.

Syntax:

SELECT *

FROM  Table_name;

Example:

SELECT *

FROM STUDENT;

It will retrieve all records and all the columns from the table. Where condition is not specified to fetch a particular record.