2. What is SQL?
SQL stands for Structured Query Language. SQL is a standard
language for storing, manipulating and retrieving data in
databases.
sql 2
3. History of SQL
SQL was one of the first commercial languages for Edgar F. Codd's
relational model. The model was described in his influential 1970
paper, "A Relational Model of Data for Large Shared Data Banks".
Despite not entirely adhering to the relational model as described by
Codd, it became the most widely used database language.
sql 3
4. What Can SQL do?
•SQL can execute queries against a database.
•SQL can retrieve data from a database,
•SQL can insert records in a database,
•SQL can update records in a database
•SQL can delete records from a database
•SQL can create new databases
•SQL can create new tables in a database
•SQL can create stored procedures in a database SQL can create
views in a database
•SQL can set permissions on tables, procedures, and views.
sql 4
5. Database management systems that use SQL are:
Oracle, Sybase, Microsoft SQL Server, PHPmyadmin, Access,
Ingres, etc. Although most database systems use SQL, most of
them also have their own additional proprietary extensions that
are usually only used on their system.
sql 5
6. Some of The Most Important SQL Commands:
• SELECT - extracts data from a database
• UPDATE - updates data in a database
• DELETE - deletes data from a database
• INSERT INTO - inserts new data into a database
• CREATE DATABASE - creates a new database
• ALTER DATABASE - modifies a database
• CREATE TABLE - creates a new table
• ALTER TABLE - modifies a table
• DROP TABLE - deletes a table
• CREATE INDEX - creates an index (search key)
• DROP INDEX - deletes an index
sql 6
7. Most Basic SQL Syntax:
SELECT
SELECT column1, column2, ...
FROM table_name;
UPDATE
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
DELETE
DELETE FROM table_name WHERE condition;
EXISTS
SELECT column_name(s)
FROM table_name
WHERE EXISTS
(SELECT column_name FROM table_name WHERE condition);
INSERT INTO SELECT
Copy all columns from one table to another table:
INSERT INTO table2
SELECT * FROM table1
WHERE condition;
sql 7