SQL statements

The SQL statements can be subdivided into several categories. Some of them are;

  • Data manipulation language
  • Data definition language
  • Data control language
  • Transaction control language

Data manipulation language

Data manipulation consists of statements that are used to manipulate data in the database. It has four main statements, namely, SELECT, INSERT, UPDATE, DELETE.

SELECT statement

The select statement is used to select specific records from the table. For example, assume that we have a student’s table.

SELECT* FROM students   – Gets all the students details from the table

SELECT course FROM students   – returns all the courses pursued by the students from the student table.

You can also select several columns from the table by specifying their names and separating them with a comma.

For example;

SELECT studentsName, studentsAge, studentsCourse FROM students.

In some cases, you might have duplicates. For instance, when choosing the courses, several students take a similar course, and you don’t want the course name to repeat itself in the fields. To do that, you use the keyword DISTINCT

SELECT DISTINCT course FROM students

INSERT statement

This statement is used to insert new columns into the table. Syntax;

INSERT INTO table_name (column1, column2…..) VALUES (value1, value2… )

For instance, in our student’s table, you want to add a new student.;

INSERT INTO students (students_name, students_class, students_course)

VALUES ( John Doe, 8A, Bsc computer science)      

UPDATE statement

The UPDATE statement is used to modify the existing records in a table based on some conditions—the where clause is used to set the condition.

UPDATE student  SET student_Name= ‘Manoj’ WHERE student_Name= ‘Kumar’

DELETE statement

It is used to delete existing records in a table based on some conditions.

DELETE FROM student WHERE student_Name= ‘Manoj.’

Data definition language

In Data Definition Language (DDL), we have three different SQL statements.


This statement creates a new table

CREATE TABLE students(

      Name varchar(255),

     Class int,

     Age int



ALTER TABLE statement is used to add, delete, or modify columns

Alter Table Student Add (StudentAddress varchar (100))


DROP TABLE keyword statement is used to remove a table definition and all the data, indexes, permission specifications for the table.

Drop Student

Data control language (DCL)

DCL statements define the control over the data in the database. They include;


Grant gives permissions to the specified user to the specified tasks.


GRANT privilege_name

ON object_name

TO {user_name |PUBLIC |role_name}



It cancels previously granted or denied permissions.


REVOKE priviledge_name

ON object_name      

FROM {user_name |PUBLIC |role_name}

You might also like

Leave a Reply

Your email address will not be published. Required fields are marked *