Home >>DBMS Tutorial >DBMS SQL Overview
For Relational Databases, SQL is a programming language. It is built using relational algebra and relational calculus of tuples. SQL comes with all big RDBMS distributions as a package.
SQL contains all languages for data definition and data manipulation. Using SQL 's data description properties, the database schema can be designed and modified, while data manipulation properties allow SQL to store and retrieve database data.
SQL uses the following set of commands to define database schema −
CREATE
Creates new databases, tables and views from RDBMS.
For example −
Create database phptpoint; Create table article; Create view for_students;
DROP
Drops commands, views, tables, and databases from RDBMS.
For example−
Drop object_type object_name; Drop database phptpoint; Drop table article; Drop view for_students;
ALTER
Modifies database schema.
Alter object_type object_name parameters;
For example−
Alter table article add subject varchar;
In the relation article, this command adds an attribute with the subject name of the string type.
SQL is equipped with a language (DML) for data manipulation. By inserting, updating and deleting its data, DML modifies the database case. For all types of data modification in a database, DML is responsible. In its DML section, SQL contains the following set of commands –
These basic constructs allow database programmers and users to enter and efficiently retrieve data and information into the database using a number of filter options.
SELECT/FROM/WHERE
For example −
Select author_name From book_author Where age > 50;
This command yield the names of authors of a book-author relation whose age is greater than 50.
INSERT INTO/VALUES
This command is used to insert values into the table (relation) rows.
Syntax−
INSERT INTO table (column1 [, column2, column3 ... ]) VALUES (value1 [, value2, value3 ... ])
Or
INSERT INTO article (Author, Subject) VALUES ("anonymous", "computers");
UPDATE/SET/WHERE
This command is used to removing a table (relation) from one or more rows.
Syntax −
DELETE FROM table_name [WHERE condition];
For example −
DELETE FROM article WHERE Author="unknown";