DBMS

There are 5 types of SQL Commands:

  1. DDL (Data Definition Language):

Commands in DDL

CREATE : It is used to create a new table in database.

DROP : It is used to delete both the structure and record stored in the table.

ALTER : It is used to alter the structure of the database. This change could be either to modify the characteristics of an existing attribute or probably to add a new attribute.

TRUNCATE : It is used to delete all the rows from the table and free the space containing the table.

  1. DML (Data Manipulation Language):

Commands in DML

INSERT : The INSERT statement is a SQL query. It is used to insert data into the row of a table.

UPDATE : This command is used to update or modify the value of a column in the table.

DELETE : It is used to remove one or more row from a table.

  1. DCL (Data Control Language):

Commands in DCL

GRANT : It is used to give user access privileges to a database.

REVOKE : It is used to take back permissions from the user.

  1. TCL (Transaction Control Language) :

Commands in TCL

COMMIT : Commit command is used to save all the transactions to the database.

ROLLBACK : Rollback command is used to undo transactions that have not already been saved to the database.

SAVEPOINT : It is used to roll the transaction back to a certain point without rolling back the entire transaction.

  1. DQL (Data Query Language) :

Commands in DQL

SELECT : This is the same as the projection operation of relational algebra. It is used to select the attribute based on the condition described by WHERE clause.

Basic SQL Commands

Sudo Bash

For root User

sudo service postgresql start

To start postgre sql services

sudo service postgresql stop

To stop postgre sql services