0% found this document useful (0 votes)
18 views

SQL: Structured Query Language

SQL is a standard language used to communicate with relational databases. It allows users to create databases, enter and manipulate data, and query databases. The document discusses SQL syntax for creating tables, inserting data, extracting data with queries, and deleting data.

Uploaded by

yash
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

SQL: Structured Query Language

SQL is a standard language used to communicate with relational databases. It allows users to create databases, enter and manipulate data, and query databases. The document discusses SQL syntax for creating tables, inserting data, extracting data with queries, and deleting data.

Uploaded by

yash
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 15

SQL: STRUCTURED QUERY LANGUAGE

SQL
 SQL stands for Structured Query Language
 SQL, Structured Query Language, is the standard language used to
communicate with a relational database.
 It works well on Oracle, Microsoft SQL Server, Sybase, Informix,
and others.
 With SQL, you can build databases, enter data into the database,
manipulate data, and query the database.
 SQL is a simple, English-like language that is relatively easy to
learn.
 It is Case-Insensitive.
WAYS OF CREATING/MAINTAINING
DATABASE
 Command-line based
 GUI based
SOME IMPORTANT OPERATIONS
 Creating database
 Inserting values in database

 Extracting/Retrieving data

 Deleting data/table
ATTRIBUTE DATA TYPES
 CHAR(size): character strings of fixed length.
 VARCHAR(size)/VARCHAR2(size): character strings of
variable length.
 NUMBER (P, S): to store fixed or floating point numbers.
 P (precision): max length of data
 S (scale): determines the number of places to the

right of the decimal.


 DATE: To represent date and time.
 And others
TABLE STRUCTURE
 Department (Table Name)

Dept Name Dept Id Chairman ID


(Character String) (Integer) (Character String)
Computer Science 007 COMSCIAMU
Chemical Engineering 008 CHESCIAMU

- - -
- - -
- - -
TABLE STRUCTURE
 Department (Table Name)

Dept Name Dept Id Chairman ID


(Character String) (Integer) (Character String)
Computer Science 007 COMSCIAMU
Chemical Engineering 008 CHESCIAMU

- - -
- - -
- - -
TABLE STRUCTURE
 Department (Table Name)

Dept Name Dept Id Chairman ID


(Character String) (Integer) (Character String)
Computer Science 007 COMSCIAMU
Chemical Engineering 008 CHESCIAMU

- - -
- - -
- - -
TABLE STRUCTURE
 Department (Table Name)

Dept Name Dept Id Chairman ID


(Character String) (Integer) (Character String)
Computer Science 007 COMSCIAMU
Chemical Engineering 008 CHESCIAMU

- - -
- - -
- - -
CREATE TABLE SYNTAX
 CREATE TABLE Command in SQL-

Slide 2-10
CREATE TABLE department
( Dname VARCHAR2(15) ,
Dnumber NUMBER,
Mgr_ssn CHAR(9)
);
INSERTING DATA INTO TABLE SYNTAX
 INSERT INTO command-

Slide 2-11
INSERT INTO department
VALUES ( ‘Computer Science’ , 007, ‘COMSCIAMU’ );
EXTRACTING DATA FROM TABLE
 SELECT command-

 Extracting whole table


 SELECT * FROM department;

 Extracting some columns


 SELECT Dname , Mgr_ssn FROM department;

 Extracting some rows


 SELECT * FROM department

WHERE Dnumber=007;

 Extracting some rows and some columns


 SELECT Dname , Mgr_ssn FROM department WHERE
Mgr_ssn='COMSCIAMU';
DELETING RECORDS FROM TABLE
 DELETE FROM command:

 Deleting all records:


 DELETE FROM department;

 Deleting particular rows:


 DELETE FROM department WHERE Dnumber=007;
DELETING COMPLETE TABLE
 DROP command-

 DROP TABLE department;


RESOURCES
 Software:
 Oracle 11g express edition
 Freely available

 Book:
 SQL, PL/SQL by Ivan Bayross

You might also like