SlideShare a Scribd company logo
1 of 19
Adarsh College, Vita
Department of BCA
Presentation
On
Introduction to SQL
By
Asst.Prof.Ghorpade D.L
Objectives
• Explore basic commands and functions of
SQL
• How to use SQL for data administration (to
create tables, indexes, and views)
• How to use SQL for data manipulation (to
add, modify, delete, and retrieve data)
• How to use SQL to query a database to
extract useful information
Introduction to SQL
• SQL functions
 Data definition
User define the structure.
 Data retrieval
User retrieve stored data from the database.
 Data manipulation
User to update database by adding new data,
removing old data and modifying previously
stored data.
 Access Control
Restricting user’s unauthorized access.
 Data sharing
Data sharing by concurrent users.
 Data integrity
Protecting it from corruption due to
inconsistent updates or system failures
SQL Data Types
• Character Data Type
 CHAR(size)
Fixed length character data of length size
bytes. This should be used for fixed length data.
2000 bytes Default and minimum size is 1 byte.
 VARCHAR2(size)
Variable length character string having
maximum length size bytes. You must specify size.
4000 bytes minimum is 1
 NVARCHAR2(size)
Variable length national character set string
having maximum length size bytes. You must specify
size. 4000 bytes minimum is 1.
 NCHAR(size)
Fixed length national character set data of
length size bytes. This should be used for fixed length
data. Such as codes A100, B102... 2000 bytes Default
and minimum size is 1 byte.
• Numeric Data Type
 NUMBER(p,s)
Number having precision p and scale s. The
precision p can range from 1 to 38. The scale s can
range from -84 to 127.
 INTEGER or INT
A 64-bit signed integer value with an implied
scale of zero.
 FLOAT(p)
A single or double precision floating point
number value ,precision up to a maximum of 64. 7
 DECIMAL [(p[,s])] or DEC [(p[,s])]
 DECIMAL - Precision defaults to 38,Scale
defaults to zero.
 DECIMAL (p)- Scale defaults to zero.
DECIMAL (p,s)- Precision & Scale are defined by
user.
DATE
Date value should be specified in the form:
YYYY-MM-DD
 TIMESTAMP
Timestamp value should be specified in the form:
YYYY-MM-DD HH:MM:SS
Classification of SQL Commands
1. DDL (Data definition language)
The DDL part of SQL permits database tables
to be created or deleted.
Example
a. CREATE TABLE
b. ALTER TABLE
c. DROP TABLE
d. CREATE INDEX
e. DROP INDEX
f. GRANT
g. REVOKE
2. DML(Data manipulation languages)
It is used to manipulate data through queries
it also change the content of a table.
Examples
a. INSERT : To insert data into table.
b. SELECT : To display data from a table.
c. DELETE : Delete all records from a table, the space for
the record remain.
d. UPDATE : To change the content of a table.
e. LOCK : Table control concurrency.
3. DCL(Data Control languages)
That control access to data and to the
database.
Examples
a. COMMIT : Save work done.
b. SAVEPONT : Indentify a point in a transaction to which
can later rollback.
c. SET TRANSACTION : Change transaction option like
what rollback segment to use.
d. GRANT/REVOKE : grant or take back permission to or
from the oracle user.
4. DQL(Data query languages)
That allows getting data from the database
and imposing ordering upon it.
Examples
a. SELECT : Retrieves data from table.
THE CREATE TABLE COMMAND
The create table command defines each column of
table uniquely. Each column has a minimum three
attributes a name, data type and size.
Rules for creating a table
1. A name can have maximum up to 10 characters.
2. Alphabets from A-Z, a-z and digits 0-9 are allowed.
3. A name should begin with alphabet.
4. Only use special character as _(underscore).
Syntax :
Create table <table name>
(<column name1><data type> (<size>),
< column name2><data type> (<size>));
Example
SQL>create table emp(empno number(4),
ename varchar(10),
job char(10),
mgr number(4),
hiredate date,
sal number(7,2),
comm number(7,2),
deptno number(2));
SQL>Table created
Modifying the structure of Table
1.Adding New Columns
Alter Command
Used to alter structure of DB.
Syntax :
alter table <table name>
add(<newcolumn name><data type> (<size>),
< newcolumn name><data type> (<size>));
Example:
Enter a new field eaddress in the table emp.
SQL> alter table emp
add(eaddress varchar2(30));
SQL> table altered
Modifying the structure of Table
2. Modifying Existing Columns
Alter Command
Only modifying column size can be increased.
Syntax :
alter table <table name>
modify(<newcolumn name><new data type>
(<new size>));
Example:
SQL> alter table emp
modify(ename varchar2(25));
Modifying the structure of Table
3. Dropping an Existing Columns
Alter Command
To drop an existing column.
Example:
SQL> alter table emp drop column city;
• The multiple columns can be dropped in single
command.
SQL> alter table emp drop column (city,address);
Modifying the structure of Table
4. Dropping Tables
Table can be deleted using drop table command.
Syntax :
SQL>drop table tablename;
Example:
SQL>drop table emp;
5.Truncate Command
Removes all records from a table including all space allocated
for the records are removed.
Syntax :
SQL>truncate table tablename;
Example:
SQL>truncate table emp;

More Related Content

What's hot (19)

Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Sql server T-sql basics ppt-3
Sql server T-sql basics  ppt-3Sql server T-sql basics  ppt-3
Sql server T-sql basics ppt-3
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Sql fundamentals
Sql fundamentalsSql fundamentals
Sql fundamentals
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
 
What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?
 
Structured query language(sql)ppt
Structured query language(sql)pptStructured query language(sql)ppt
Structured query language(sql)ppt
 
Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
 
Database Architecture and Basic Concepts
Database Architecture and Basic ConceptsDatabase Architecture and Basic Concepts
Database Architecture and Basic Concepts
 
Basic SQL and History
 Basic SQL and History Basic SQL and History
Basic SQL and History
 
Sql a practical introduction
Sql   a practical introductionSql   a practical introduction
Sql a practical introduction
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Sql intro & ddl 1
Sql intro & ddl 1Sql intro & ddl 1
Sql intro & ddl 1
 
Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)
 
12 SQL
12 SQL12 SQL
12 SQL
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
Sql commands
Sql commandsSql commands
Sql commands
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 

Similar to Introduction to (sql)

dbs class 7.ppt
dbs class 7.pptdbs class 7.ppt
dbs class 7.pptMARasheed3
 
SQL: Data Definition Language commands.pptx
SQL: Data Definition Language commands.pptxSQL: Data Definition Language commands.pptx
SQL: Data Definition Language commands.pptxPallaviPatil905338
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql newSANTOSH RATH
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...SakkaravarthiS1
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxEliasPetros
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasadpaddu123
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasadpaddu123
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL CommandsShrija Madhu
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxEliasPetros
 
Database Management Lab -SQL Queries
Database Management Lab -SQL Queries Database Management Lab -SQL Queries
Database Management Lab -SQL Queries shamim hossain
 
Less08_Schema Advanced Databases and Management.pptx
Less08_Schema Advanced Databases and Management.pptxLess08_Schema Advanced Databases and Management.pptx
Less08_Schema Advanced Databases and Management.pptxMurtazaMughal13
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statementsMohd Tousif
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptDrRShaliniVISTAS
 

Similar to Introduction to (sql) (20)

dbs class 7.ppt
dbs class 7.pptdbs class 7.ppt
dbs class 7.ppt
 
Lab
LabLab
Lab
 
Sql intro & ddl 1
Sql intro & ddl 1Sql intro & ddl 1
Sql intro & ddl 1
 
SQL: Data Definition Language commands.pptx
SQL: Data Definition Language commands.pptxSQL: Data Definition Language commands.pptx
SQL: Data Definition Language commands.pptx
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql new
 
Module 3
Module 3Module 3
Module 3
 
intro for sql
intro for sql intro for sql
intro for sql
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
Module02
Module02Module02
Module02
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
Rdbms day3
Rdbms day3Rdbms day3
Rdbms day3
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
 
Database Management Lab -SQL Queries
Database Management Lab -SQL Queries Database Management Lab -SQL Queries
Database Management Lab -SQL Queries
 
12 SQL
12 SQL12 SQL
12 SQL
 
Less08_Schema Advanced Databases and Management.pptx
Less08_Schema Advanced Databases and Management.pptxLess08_Schema Advanced Databases and Management.pptx
Less08_Schema Advanced Databases and Management.pptx
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
 

Recently uploaded

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 

Recently uploaded (20)

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 

Introduction to (sql)

  • 1. Adarsh College, Vita Department of BCA Presentation On Introduction to SQL By Asst.Prof.Ghorpade D.L
  • 2. Objectives • Explore basic commands and functions of SQL • How to use SQL for data administration (to create tables, indexes, and views) • How to use SQL for data manipulation (to add, modify, delete, and retrieve data) • How to use SQL to query a database to extract useful information
  • 3. Introduction to SQL • SQL functions  Data definition User define the structure.  Data retrieval User retrieve stored data from the database.  Data manipulation User to update database by adding new data, removing old data and modifying previously stored data.
  • 4.  Access Control Restricting user’s unauthorized access.  Data sharing Data sharing by concurrent users.  Data integrity Protecting it from corruption due to inconsistent updates or system failures
  • 5. SQL Data Types • Character Data Type  CHAR(size) Fixed length character data of length size bytes. This should be used for fixed length data. 2000 bytes Default and minimum size is 1 byte.  VARCHAR2(size) Variable length character string having maximum length size bytes. You must specify size. 4000 bytes minimum is 1
  • 6.  NVARCHAR2(size) Variable length national character set string having maximum length size bytes. You must specify size. 4000 bytes minimum is 1.  NCHAR(size) Fixed length national character set data of length size bytes. This should be used for fixed length data. Such as codes A100, B102... 2000 bytes Default and minimum size is 1 byte.
  • 7. • Numeric Data Type  NUMBER(p,s) Number having precision p and scale s. The precision p can range from 1 to 38. The scale s can range from -84 to 127.  INTEGER or INT A 64-bit signed integer value with an implied scale of zero.  FLOAT(p) A single or double precision floating point number value ,precision up to a maximum of 64. 7
  • 8.  DECIMAL [(p[,s])] or DEC [(p[,s])]  DECIMAL - Precision defaults to 38,Scale defaults to zero.  DECIMAL (p)- Scale defaults to zero. DECIMAL (p,s)- Precision & Scale are defined by user. DATE Date value should be specified in the form: YYYY-MM-DD  TIMESTAMP Timestamp value should be specified in the form: YYYY-MM-DD HH:MM:SS
  • 9. Classification of SQL Commands 1. DDL (Data definition language) The DDL part of SQL permits database tables to be created or deleted. Example a. CREATE TABLE b. ALTER TABLE c. DROP TABLE d. CREATE INDEX e. DROP INDEX f. GRANT g. REVOKE
  • 10. 2. DML(Data manipulation languages) It is used to manipulate data through queries it also change the content of a table. Examples a. INSERT : To insert data into table. b. SELECT : To display data from a table. c. DELETE : Delete all records from a table, the space for the record remain. d. UPDATE : To change the content of a table. e. LOCK : Table control concurrency.
  • 11. 3. DCL(Data Control languages) That control access to data and to the database. Examples a. COMMIT : Save work done. b. SAVEPONT : Indentify a point in a transaction to which can later rollback. c. SET TRANSACTION : Change transaction option like what rollback segment to use. d. GRANT/REVOKE : grant or take back permission to or from the oracle user.
  • 12. 4. DQL(Data query languages) That allows getting data from the database and imposing ordering upon it. Examples a. SELECT : Retrieves data from table.
  • 13. THE CREATE TABLE COMMAND The create table command defines each column of table uniquely. Each column has a minimum three attributes a name, data type and size. Rules for creating a table 1. A name can have maximum up to 10 characters. 2. Alphabets from A-Z, a-z and digits 0-9 are allowed. 3. A name should begin with alphabet. 4. Only use special character as _(underscore).
  • 14. Syntax : Create table <table name> (<column name1><data type> (<size>), < column name2><data type> (<size>));
  • 15. Example SQL>create table emp(empno number(4), ename varchar(10), job char(10), mgr number(4), hiredate date, sal number(7,2), comm number(7,2), deptno number(2)); SQL>Table created
  • 16. Modifying the structure of Table 1.Adding New Columns Alter Command Used to alter structure of DB. Syntax : alter table <table name> add(<newcolumn name><data type> (<size>), < newcolumn name><data type> (<size>)); Example: Enter a new field eaddress in the table emp. SQL> alter table emp add(eaddress varchar2(30)); SQL> table altered
  • 17. Modifying the structure of Table 2. Modifying Existing Columns Alter Command Only modifying column size can be increased. Syntax : alter table <table name> modify(<newcolumn name><new data type> (<new size>)); Example: SQL> alter table emp modify(ename varchar2(25));
  • 18. Modifying the structure of Table 3. Dropping an Existing Columns Alter Command To drop an existing column. Example: SQL> alter table emp drop column city; • The multiple columns can be dropped in single command. SQL> alter table emp drop column (city,address);
  • 19. Modifying the structure of Table 4. Dropping Tables Table can be deleted using drop table command. Syntax : SQL>drop table tablename; Example: SQL>drop table emp; 5.Truncate Command Removes all records from a table including all space allocated for the records are removed. Syntax : SQL>truncate table tablename; Example: SQL>truncate table emp;