0% found this document useful (0 votes)
12 views16 pages

SQL Notes IMPORTANT

This document discusses SQL concepts and commands. It explains how SQL allows accessing and manipulating databases by creating, altering, and dropping databases and tables. It also covers SQL commands for inserting, updating, deleting, and retrieving data from databases.

Uploaded by

aarushigarg34788
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views16 pages

SQL Notes IMPORTANT

This document discusses SQL concepts and commands. It explains how SQL allows accessing and manipulating databases by creating, altering, and dropping databases and tables. It also covers SQL commands for inserting, updating, deleting, and retrieving data from databases.

Uploaded by

aarushigarg34788
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

IIS (deemed to be University)

Structured Query Language

SQL
Contents
 SQL Concepts
 SQL Commands
 SQL Syntax
SQL Concepts
 SQL allows access and manipulation of databases.
 Function of SQL in database
◦ Create Databases
◦ Create Tables
◦ Create stored procedures
◦ Create views
◦ Set permissions on tables, procedures, and views
◦ Execute queries
◦ Insert records
◦ Update records
◦ Delete records
◦ Retrieve data
SQL Commands

 CREATE DATABASE - creates a new database


 ALTER DATABASE - modifies a database
 CREATE TABLE - creates a new table
 INSERT INTO - inserts new data into a database
 ALTER TABLE - modifies a table
 DROP TABLE - deletes a table
 SELECT - extracts data from a database
 UPDATE - updates data in a database
 DELETE - deletes data from a database
Create Database
CREATE DATABASE databasename;
Drop Database
DROP DATABASE databasename;
Create Table in Database
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
);
Drop Table in Database
DROP TABLE table_name;
Alter Table in Database
ALTER TABLE table_name
ADD column_name datatype;
Access Records from Table
SELECT column1, column2, ...
FROM table_name;
SELECT DISTINCT column1, column2, ...
FROM table_name;
SELECT column1, column2, ...
FROM table_name
WHERE condition;
SELECT column1, column2, ...
FROM table_name
WHERE NOTcondition1 AND/OR condition2 AND/OR condition3 ...;
SELECT column1, column2, ...
FROM table_name
ORDER BY column1, column2, ... ASC|DESC;
SELECT column_names
FROM table_name
WHERE column_name IS/IS NOT NULL;
Insert Records in Table
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
Update Table in Database
 UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Delete Records from Table
 DELETE FROM table_name WHERE condition;
SQL Constraints
 CREATE TABLE table_name (
column1 datatype constraint,
column2 datatype constraint,
column3 datatype constraint,
....
);

 Constraints
◦ NOT NULL
◦ UNIQUE
◦ PRIMARY KEY
◦ FOREIGN KEY
◦ CHECK
◦ DEFAULT
◦ INDEX
References
 Silberschatz, A., Korth, H. F., & Sudarshan, S. (2016). Introduction
to Data base Management System.
 Rob, P., Coronel, C., Silberschatz, A., Korth, H., & Sudarshan, S.
(2006). Database systems: Design, implementation. Management.
Seventh Edition. Course Technology.
 Elmasri, R., & Navathe, S. (2016). Fundamentals of database
systems. London: Pearson.
Queries??

You might also like