SlideShare a Scribd company logo
1 of 11
Data Definition Language
commands in SQL
Mrs. Pallavi Patil
Introduction to structural query language
• SQL (Structured Query Language) is used to perform operations on the
records stored in the database such as updating records, deleting records,
creating and modifying tables, views, etc.
• SQL is just a query language; it is not a database. To perform SQL queries,
you need to install any database, for example, Oracle, MySQL, PostGre
SQL, SQL Server, DB2, etc.
Mrs. Pallavi Patil
Advantages of SQL
• High speed
• Portable
• Easy to learn and understand
• Supports object oriented programming
• Used with all DBMS system with any vendor
• No coding required
• Used for relational database
• Complete language for database
• Can be used as programming and interactive language
• Dynamic database language
• Client / server language
• Multiple data views
Mrs. Pallavi Patil
Data types
• Char
It is used to specify a fixed length string that can contain numbers, letters, and
special characters. Its size can be 0 to 255 characters. Default is 1.
Stud_name char(20)
• Varchar and varchar2:
It is used to specify a variable length string that can contain numbers, letters,
and special characters.
Varchar is used to store maximum data up to 4000 characters
Varchar2 holds variable length character string. Maximum data stored in this
type is 32767 characters.
Stud_name varchar(20)
Mrs. Pallavi Patil
• Number (p,s)
It contains precision p and scale s. The precision p can range from 1 to 38, and the
scale s can range from -84 to 127.
Ex. Marks number(5)
• Date
It is used to store a valid date-time format with a fixed length. By default format
for date is DD-MON-YY
birthDate date
Ex. 11-MAR-14
• Long
This datatype is used to store variable length string containing data up to 2 GB.
Mrs. Pallavi Patil
Components of SQL
• DDL
 use to create structure of table/ schema.
• DML
 use to manipulate data stored in database.
DQL
 use to fetch the data from database on the basis of perticular condition applied
by user.
• DCL
 DCL commands are used to grant and take back authority from any database
user.
• Transaction Control Language (TCL)
 Use to control different operations performed on records.
Mrs. Pallavi Patil
DDL commands
1) CREATE
It is used to create table structure with particular name.
Syntax:
Create table <table_name> (colunmName1 datatype (size), colunmName2
datatype (size),………., colunmNamen datatype (size));
Ex. Create table Student_info(Rollno number(5), Stud_name varchar2(20),
marks number(4,2));
Mrs. Pallavi Patil
2) DESC
This command is used to describe the structure of created table.
Syntax:
DESC table_name;
DESC student_info;
3) ALTER
• This command is used to make changes or modification in the created table.
• With this command we can add , modify or delete columns in the created table.
Syntax 1: For adding new column into table
Alter table < table_name> add ( columnName datatype (size));
Ex. Alter table student_info add (city varchar(10));
Mrs. Pallavi Patil
Syntax 2: for modifying created column in table
Alter table < table_name> modify ( columnName datatype (size));
Ex. Alter table student_info modify (city varchar(20));
• Syntax 3: renaming column name
• Alter table <table_name> Rename column <old column_name> to <new
column_name>;
• Syntax 4: For deleting column from existing table
Alter table <table_name> drop (column_name);
Ex. Alter table student_info drop(city);
Mrs. Pallavi Patil
4) RENAME
It is used to change the name of created table.
Syntax:
Rename <old_tablename> to <new_tablename>;
Ex. Rename student_info to student;
5) TRUNCATE
This command is used to remove all records or data from table but table
structure remains as it is database.
Syntax:
Truncate table <table_name>;
Ex. Truncate table student;
Mrs. Pallavi Patil
6) DROP
This command is used to delete or remove entire table structure from
database.
Syntax:
Drop table <table_name>;
Ex. Drop table student;
Mrs. Pallavi Patil

More Related Content

Similar to SQL: Data Definition Language commands.pptx

Similar to SQL: Data Definition Language commands.pptx (20)

Module02
Module02Module02
Module02
 
STRUCTURED QUERY LANGUAGE
STRUCTURED QUERY LANGUAGESTRUCTURED QUERY LANGUAGE
STRUCTURED QUERY LANGUAGE
 
Structured Query Language
Structured Query LanguageStructured Query Language
Structured Query Language
 
Sql intro & ddl 1
Sql intro & ddl 1Sql intro & ddl 1
Sql intro & ddl 1
 
Sql intro & ddl 1
Sql intro & ddl 1Sql intro & ddl 1
Sql intro & ddl 1
 
dbs class 7.ppt
dbs class 7.pptdbs class 7.ppt
dbs class 7.ppt
 
SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
 
intro for sql
intro for sql intro for sql
intro for sql
 
COMPUTERS SQL
COMPUTERS SQL COMPUTERS SQL
COMPUTERS SQL
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
 
DBMS unit-3.pdf
DBMS unit-3.pdfDBMS unit-3.pdf
DBMS unit-3.pdf
 
12 SQL
12 SQL12 SQL
12 SQL
 
12 SQL
12 SQL12 SQL
12 SQL
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
 
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
 
chapter-14-sql-commands.pdf
chapter-14-sql-commands.pdfchapter-14-sql-commands.pdf
chapter-14-sql-commands.pdf
 
DBMS Part-3.pptx
DBMS Part-3.pptxDBMS Part-3.pptx
DBMS Part-3.pptx
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 

Recently uploaded

MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 

Recently uploaded (20)

MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 

SQL: Data Definition Language commands.pptx

  • 1. Data Definition Language commands in SQL Mrs. Pallavi Patil
  • 2. Introduction to structural query language • SQL (Structured Query Language) is used to perform operations on the records stored in the database such as updating records, deleting records, creating and modifying tables, views, etc. • SQL is just a query language; it is not a database. To perform SQL queries, you need to install any database, for example, Oracle, MySQL, PostGre SQL, SQL Server, DB2, etc. Mrs. Pallavi Patil
  • 3. Advantages of SQL • High speed • Portable • Easy to learn and understand • Supports object oriented programming • Used with all DBMS system with any vendor • No coding required • Used for relational database • Complete language for database • Can be used as programming and interactive language • Dynamic database language • Client / server language • Multiple data views Mrs. Pallavi Patil
  • 4. Data types • Char It is used to specify a fixed length string that can contain numbers, letters, and special characters. Its size can be 0 to 255 characters. Default is 1. Stud_name char(20) • Varchar and varchar2: It is used to specify a variable length string that can contain numbers, letters, and special characters. Varchar is used to store maximum data up to 4000 characters Varchar2 holds variable length character string. Maximum data stored in this type is 32767 characters. Stud_name varchar(20) Mrs. Pallavi Patil
  • 5. • Number (p,s) It contains precision p and scale s. The precision p can range from 1 to 38, and the scale s can range from -84 to 127. Ex. Marks number(5) • Date It is used to store a valid date-time format with a fixed length. By default format for date is DD-MON-YY birthDate date Ex. 11-MAR-14 • Long This datatype is used to store variable length string containing data up to 2 GB. Mrs. Pallavi Patil
  • 6. Components of SQL • DDL  use to create structure of table/ schema. • DML  use to manipulate data stored in database. DQL  use to fetch the data from database on the basis of perticular condition applied by user. • DCL  DCL commands are used to grant and take back authority from any database user. • Transaction Control Language (TCL)  Use to control different operations performed on records. Mrs. Pallavi Patil
  • 7. DDL commands 1) CREATE It is used to create table structure with particular name. Syntax: Create table <table_name> (colunmName1 datatype (size), colunmName2 datatype (size),………., colunmNamen datatype (size)); Ex. Create table Student_info(Rollno number(5), Stud_name varchar2(20), marks number(4,2)); Mrs. Pallavi Patil
  • 8. 2) DESC This command is used to describe the structure of created table. Syntax: DESC table_name; DESC student_info; 3) ALTER • This command is used to make changes or modification in the created table. • With this command we can add , modify or delete columns in the created table. Syntax 1: For adding new column into table Alter table < table_name> add ( columnName datatype (size)); Ex. Alter table student_info add (city varchar(10)); Mrs. Pallavi Patil
  • 9. Syntax 2: for modifying created column in table Alter table < table_name> modify ( columnName datatype (size)); Ex. Alter table student_info modify (city varchar(20)); • Syntax 3: renaming column name • Alter table <table_name> Rename column <old column_name> to <new column_name>; • Syntax 4: For deleting column from existing table Alter table <table_name> drop (column_name); Ex. Alter table student_info drop(city); Mrs. Pallavi Patil
  • 10. 4) RENAME It is used to change the name of created table. Syntax: Rename <old_tablename> to <new_tablename>; Ex. Rename student_info to student; 5) TRUNCATE This command is used to remove all records or data from table but table structure remains as it is database. Syntax: Truncate table <table_name>; Ex. Truncate table student; Mrs. Pallavi Patil
  • 11. 6) DROP This command is used to delete or remove entire table structure from database. Syntax: Drop table <table_name>; Ex. Drop table student; Mrs. Pallavi Patil