What is SQL? | List of SQL Commands | SQL Queries

What is SQL?

SQL (Structured Query Language) is used to perform operations on the records stored in database like creating and modifying tables, updating records, deleting records, views, functions etc.

Structured Query Language is just a query language, it is not a database or tables. To perform SQL queries, first you need to install any database for example Oracle, MySQL, MongoDB, PostGre SQL, SQL Server, DB2, SQLite etc.


SQL Commands

SQL commands are the set of instructions, coded into SQL statements, which are used to communicate with the database to perform specific tasks, functions and queries with particular data.

SQL commands can not be used only for searching from the database but also to perform various other functions like, for example, you can create tables, add data into tables, or modify data, drop or delete the table. These are grouped into four major categories depending on their functionality:

  • Data Definition Language (DDL) – DDL SQL commands are used for creating, modifying, and dropping the structure of database objects(dbo). DDL commands are CREATE, ALTER, DROP, RENAME, and TRUNCATE.
  • Data Manipulation Language (DML) – These SQL commands are used for storing, retrieving, modifying, and deleting data from a database. These DML commands are: SELECT, INSERT, UPDATE, and DELETE.
  • Transaction Control Language (TCL) – These SQL commands are used for managing changes affecting the data. It is also used for data integrity. TCL commands are COMMIT, ROLLBACK, and SAVEPOINT.
  • Data Control Language (DCL) – DCL SQL commands are used for security purpose. These commands are GRANT and REVOKE.
SQL Commands | SQL Queries | Tech-Mirror
SQL Commands | SQL Queries | Tech-Mirror

SQL Queries

SQL DATABASE

CREATE, DROP and RENAME DATABASE

SQL TABLE

CREATE, DROP, DELETE, RENAME, TRUNCATE and COPY TABLE

SQL SELECT

SELECT statement with UNIQUE, DISTINCT, AS and IN keywords and first(), last(), top(), sum(), random() and count() functions.

SQL INSERT

INSERT INTO, INSERT SELECT and INSERT multiple rows.

SQL UPDATE

UPDATE statement, update with JOIN and update DATE.

SQL DELETE

DELETE TABLE, DELETE One Row, DELETE all rows, DELETE VIEW, DELETE database, DELETE duplicate rows and DELETE with INNER JOIN.

SQL JOINs

INNER JOIN, OUTER JOIN, LEFT OUTER JOIN, RIGHT OUTER JOIN and SELF JOIN.

SQL Keys

SQL keys are primary key, foreign key, composite key, alternate key and unique key.

For more Database Design

Leave a Reply

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