Structured Query Language (SQL) is the standard language used for writing queries in a databases. It was approved by ISO (International Standard Organization) and ANSI(American National Standards Institute).
SQL contains of some important features and they are:
- Data Definition language (DDL):
It contains of commands which defines the data. The commands are:
create: It is used to create a table.
create table tablename(attribute1 datatype......attributen datatype);
drop: It is used to delete the table including all the attributes.
drop table tablename;
alter: alter is a reserve word which modifies the structure of the table.
alter table tablename add(new column1 datatype......new columnx datatype);
rename: A table name can be changed using the reserver ‘rename’
rename old table name to new table name;
- Data Manipulation Language (DML):
Data Manipulation Language contains commands used to manipulate the data.
The commands are:
insert: This command is generally used after the create command to insert a set of values into the table.
insert into tablename values(attribute1 datatype); : : : insert into tablename values (attributen datatype);
delete: A command used to delete particular tuples or rows or cardinality from the table.
delete from tablename where condition;
update: It updates the tupples in a table.
update tablename set tupplename='attributename';
Triggers are actions performed when certain conditions are met on the data.
A trigger contains of three parts.
- (i). event – The change in the database that activates the trigger is event.
- (ii). condition – A query or test that is run when the trigger is activated.
- (iii). action – A procedure that is executed when trigger is activated and the condition met is true.
- Client server execution and remote database access:
Client server technology maintains a many to one relationship of clients(many) and server(one). We have commands in SQL that control how a client application can access the database over a network.
- Security and authentication:
SQL provides a mechanism to control the database meaning it makes sure that only the particular details of the database is to be shown the user and the original database is secured by DBMS.
- Embedded SQL:
SQL provides the feature of embedding host languages such as C, COBOL, Java for query from their language at runtime.
- Transaction Control Language:
Transactions are an important element of DBMS and to control the transactions, TCL is used which has commands like commit, rollback and savepoint.
commit: It saves the database at any point whenever database is consistent.
rollback: It rollbacks/undo to the previous point of the transaction.
savepoint: It goes back to the previous transaction without going back to the entire transaction.
- Advanced SQL:
The current features include OOP ones like recursive queries, decision supporting queries and also query supporting areas like data mining, spatial data and XML(Xtensible Markup Language).
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.
- Difference between Structured Query Language (SQL) and Transact-SQL (T-SQL)
- Structured Query Language (SQL)
- Difference between Structured, Semi-structured and Unstructured data
- What is Structured Data?
- What is Semi-structured data?
- Large objects(LOBs) for Semi Structured and Unstructured Data
- Neo4j Query Cypher Language
- Database Roles in CQL (Cassandra Query Language)
- Additional Functions in CQL (Cassandra Query Language)
- SQL | SELECT Query
- SQL | Query Processing
- What are the Best Ways to Write a SQL Query?
- SQL query using COUNT and HAVING clause
- SQL Query Complexity
- SQL query to find unique column values from table
- SQL | Query to select NAME from table using different options
- SQL Query to find the Nth Largest Value in a Column using Limit and Offset
- SQL query to find second highest salary?
- Features of Oracle Server
- Features of HP Vertica
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.