Presentation is loading. Please wait.

Presentation is loading. Please wait.

SQL Unit – 2 Base Knowledge Presented By Mr. R.Aravindhan.

Similar presentations


Presentation on theme: "SQL Unit – 2 Base Knowledge Presented By Mr. R.Aravindhan."— Presentation transcript:

1 SQL Unit – 2 Base Knowledge Presented By Mr. R.Aravindhan

2 SQL SQL is a standard language for accessing and manipulating databases.

3 What is SQL? SQL stands for Structured Query Language SQL lets you access and manipulate databases SQL is an ANSI (American National Standards Institute) standard

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

5 What Can SQL do? SQL can create stored procedures in a database SQL can create views in a database SQL can set permissions on tables, procedures, and views

6 SQL DML and DDL SQL can be divided into two parts: The Data Manipulation Language (DML) and the Data Definition Language (DDL).

7 DML The query and update commands form the DML part of SQL: 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

8 DDL 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

9 SQL SELECT Statement Syntax SELECT column_name(s) FROM table_name Example SELECT LastName,FirstName FROM Persons

10 SQL SELECT DISTINCT Statement Syntax SELECT DISTINCT column_name(s) FROM table_name Example SELECT DISTINCT City FROM Persons

11 SQL WHERE Clause Syntax: SELECT column_name(s) FROM table_name WHERE column_name operator value Example: SELECT * FROM Persons WHERE City='Sandnes'

12 SQL ORDER BY Keyword Syntax: SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC Example: SELECT * FROM Persons ORDER BY LastName

13 SQL INSERT INTO Statement Syntax: INSERT INTO table_name VALUES (value1, value2, value3,...) Example: INSERT INTO Persons VALUES (4,'Nilsen', 'Johan', 'Bakken 2', 'Stavanger')

14 SQL UPDATE Statement Syntax: UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value Example: UPDATE Persons SET Address='Nissestien 67', City='Sandnes' WHERE LastName='Tjessem' AND FirstName='Jakob'

15 SQL DELETE Statement Syntax: DELETE FROM table_name WHERE some_column=some_value Example: DELETE FROM Persons WHERE LastName='Tjessem' AND FirstName='Jakob'

16 Thank You


Download ppt "SQL Unit – 2 Base Knowledge Presented By Mr. R.Aravindhan."

Similar presentations


Ads by Google