SQL is a declarative language laying its basics on relation algebra. It is a standardized language supported by all major commercial databases. The query optimizer is an important component of SQL which takes an input the SQL query and executes, it in the fastest way possible.
These are main classification of SQL queries:
- Data Manipulation Language (DML) –
It deals with the queries related to insertion, deletion and modification of rows.
- Data Definition Language (DDL) –
It deals with the creation, deletion and modification of definitions for tables and views.
A basic SQL query has the following syntax:
SELECT (attribute list) FROM (table list) [WHERE (condition)] [GROUP BY (grouping attributes)] [HAVING (group condition)] [ORDER BY (attribute list)]
where the SELECT and FROM clauses are mandatory.
- The SELECT clause lists the attributes to be retrieved.
- The FROM Clause specifies all tables
- The WHERE clause specifies the conditions for selection of records from these tables, including join conditions.
- GROUP BY specifies grouping attributes
- HAVING specifies a condition for retrieval of groups.
Various aggregator functions COUNT, SUM, MIN, MAX, and AVG can be in conjunction with grouping. ORDER BY specifies an order for displaying the result of a query.
- Tables, also called as relations are represented by a name, not exceeding 20 characters in length.
- The table names as well as the column fields should have unique names.
- While table definition, the field list is separated using commas, and each field name consists of a data type followed by length attribute enclosed in brackets.
- SQL statements must end with a semicolon.
- High performance.
- Easily compatible with most of the databases like MS Access, MS SQL server.
- Good flexibility in terms of creation of new Data Base tables and deletion of redundant tables.
- Can handle large records and multiple transactions.
- Easily accessible in the form of an open-source programming language.
- High Security: Tables, procedures and views can easily be protected using permissions
- Easy to learn and understand data
- Complex interface to understand and deal with it.
- Higher cost required to set up.
- It is a platform dependent and compound based language.
- Extra space is required for each record storage.
- Partial control given to databases, due to hidden permissions.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- SQL | Join (Inner, Left, Right and Full Joins)
- Full join and Inner join in MS SQL Server
- TCL Full Form
- LFU Full Form
- VPN Full Form
- DOS Full Form
- SAS Full Form
- OSI Model Full Form in Computer Networking
- HDMi Full Form
- LCD Full Form
- ZIP Full Form
- API Full Form
- RTC Full Form
- VLAN Full Form
- WPA Full Form
- DQL Full Form
- VGA Full Form
- ISP Full Form
- SGML Full Form
- DHCP Full Form
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.