SlideShare a Scribd company logo
1 of 15
Structure Query Language, more popularly
known as SQL is the language that is used
in most relational database system. It is
also called Structure Query Language
because it follows a rigorous set of rules
and procedures in answering queries.
SQL is a simple and powerful query
language that is capable of answering both
simple and complex queries. Any query on
a single table can be performed by using
only two basic operators, namely SELECT
and PROJECT.
 Data Definition Language (DDL)
◦ Commands that define a database, including
creating, altering, and dropping tables and
establishing constraints
 Data Manipulation Language (DML)
◦ Commands that maintain and query a database
 Data Control Language (DCL)
◦ Commands that control a database, including
administering privileges and committing data
The SQL CREATE DATABASE statement is used to
create new SQL database.
Syntax:
Basic syntax of CREATE DATABASE statement is
as follows:
SQL> CREATE DATABASE DatabaseName;
Example:
If you want to create new database <testDB>,
then CREATE DATABASE statement would be as
follows:
SQL> CREATE DATABASE testDB;
Creating a basic table involves naming the
table and defining its columns and each
column's data type. The SQL CREATE
TABLE statement is used to create a new
table.
Syntax:
Basic syntax of CREATE TABLE statement is as
follows:
SQL> CREATE TABLE table_name
( column1 datatype,
column2 datatype,
column3 datatype,
..... columnN datatype);
Example:
SQL> CREATE TABLE CUSTOMERS
( ID INT,
NAME VARCHAR (20),
AGE INT,
ADDRESS CHAR (25) ,
SALARY DECIMAL (18, 2));
SQL data type is an attribute that specifies type
of data of any object. Each column, variable and
expression has related data type in SQL.
SQL Server offers 7 categories of data types for
your use −
 Exact Numeric Data Types
 Approximate Numeric Data Types
 Date and Time Data Types
 Character Strings Data Types
 Unicode Character Strings Data Types
 Binary Data Types
 Misc Data Types
The SQL DELETE Query is used to delete the
existing records from a table.
You can use WHERE clause with DELETE query
to delete selected rows, otherwise all the
records would be deleted.
Syntax:
The basic syntax of DELETE query with WHERE
clause is as follows:
SQL> DELETE FROM table_name WHERE
[condition];
The SQL DROP TABLE statement is used to
remove a table definition and all data,
indexes, triggers, constraints, and permission
specifications for that table.
Syntax:
Basic syntax of DROP TABLE statement is as
follows:
SQL> DROP TABLE table_name;
The SQL INSERT INTO Statement is used to
add new rows of data to a table in the
database.
Syntax:
There are two basic syntaxes of INSERT INTO
statement as follows:
SQL> INSERT INTO TABLE_NAME
VALUES (value1, value2, value3,...valueN);
SQL SELECT statement is used to fetch the data
from a database table which returns data in the
form of result table. These result tables are
called result-sets.
Syntax:
The basic syntax of SELECT statement is as
follows:
SQL> SELECT column1, column2, columnN FROM
table_name;
The basic syntax of SELECT whole table is as
follows:
SQL> SELECT * FROM table_name;
The SQL WHERE clause is used to specify a condition while
fetching the data from single table or joining with multiple
tables.
If the given condition is satisfied then only it returns
specific value from the table. You would use WHERE clause
to filter the records and fetching only necessary records.
The WHERE clause is not only used in SELECT statement,
but it is also used in UPDATE, DELETE statement, etc.,
which we would examine in subsequent chapters.
Syntax:
The basic syntax of SELECT statement with WHERE clause
is as follows:
SQL> SELECT column1, column2, columnN
FROM table_name
WHERE [condition];
The SQL UPDATE Query is used to modify the
existing records in a table.
You can use WHERE clause with UPDATE query to
update selected rows otherwise all the rows
would be affected.
Syntax:
The basic syntax of UPDATE query with WHERE
clause is as follows:
SQL> UPDATE table_name
SET column1 = value1, column2 = value2....,
columnN = valueN
WHERE [condition];
The SQL DELETE Query is used to delete the
existing records from a table.
You can use WHERE clause with DELETE query
to delete selected rows, otherwise all the
records would be deleted.
Syntax:
The basic syntax of DELETE query with WHERE
clause is as follows:
SQL> DELETE FROM table_name WHERE
[condition];
SQL: The Language of Relational Databases

More Related Content

What's hot

Mercerization
MercerizationMercerization
MercerizationFacebook
 
Fabric tensile strength test
Fabric tensile strength testFabric tensile strength test
Fabric tensile strength testH.M. SIRAJ UDDIN
 
Dyeing of cotton with vat dyes
Dyeing of cotton with vat dyesDyeing of cotton with vat dyes
Dyeing of cotton with vat dyesAdane Nega
 
Printing Ingredients
Printing IngredientsPrinting Ingredients
Printing IngredientsChirag Bansal
 
Dyeing of polyester wool blends
Dyeing of polyester wool blendsDyeing of polyester wool blends
Dyeing of polyester wool blendsAdane Nega
 
Principles of various fibre testing instruments
Principles of various fibre testing instrumentsPrinciples of various fibre testing instruments
Principles of various fibre testing instrumentsK Kumar
 
Lubrication | Study On Lubrication | Lubrication In Textile
Lubrication | Study On Lubrication | Lubrication In TextileLubrication | Study On Lubrication | Lubrication In Textile
Lubrication | Study On Lubrication | Lubrication In TextileMd Rakibul Hassan
 
Study On Beam Dyeing Machine
Study On Beam Dyeing MachineStudy On Beam Dyeing Machine
Study On Beam Dyeing MachineMd Rakibul Hassan
 
stiffness,Handle,Drape properties of fabric ,Fabric property TTQC-2
stiffness,Handle,Drape properties of fabric ,Fabric property TTQC-2stiffness,Handle,Drape properties of fabric ,Fabric property TTQC-2
stiffness,Handle,Drape properties of fabric ,Fabric property TTQC-2AtiqFaysal
 
Nonwoven Presentation
Nonwoven PresentationNonwoven Presentation
Nonwoven Presentationalaminmasum1
 
Presentation on Textile Finishing
Presentation on Textile FinishingPresentation on Textile Finishing
Presentation on Textile FinishingAmanuzzaman Aman
 
Resin finishing
Resin finishingResin finishing
Resin finishingMohan Pegu
 
Finishing 1: Padding Mangles Stentering machine
Finishing 1: Padding Mangles    Stentering machineFinishing 1: Padding Mangles    Stentering machine
Finishing 1: Padding Mangles Stentering machineVijay Prakash
 

What's hot (20)

Dip dyeing presentation
Dip dyeing presentationDip dyeing presentation
Dip dyeing presentation
 
Mercerization
MercerizationMercerization
Mercerization
 
Exhaust dyeing process
Exhaust dyeing processExhaust dyeing process
Exhaust dyeing process
 
fabric structure & analysis.
fabric structure & analysis.fabric structure & analysis.
fabric structure & analysis.
 
Fabric tensile strength test
Fabric tensile strength testFabric tensile strength test
Fabric tensile strength test
 
Dyeing of cotton with vat dyes
Dyeing of cotton with vat dyesDyeing of cotton with vat dyes
Dyeing of cotton with vat dyes
 
Printing Ingredients
Printing IngredientsPrinting Ingredients
Printing Ingredients
 
Dyeing of polyester wool blends
Dyeing of polyester wool blendsDyeing of polyester wool blends
Dyeing of polyester wool blends
 
Principles of various fibre testing instruments
Principles of various fibre testing instrumentsPrinciples of various fibre testing instruments
Principles of various fibre testing instruments
 
Lubrication | Study On Lubrication | Lubrication In Textile
Lubrication | Study On Lubrication | Lubrication In TextileLubrication | Study On Lubrication | Lubrication In Textile
Lubrication | Study On Lubrication | Lubrication In Textile
 
Study On Beam Dyeing Machine
Study On Beam Dyeing MachineStudy On Beam Dyeing Machine
Study On Beam Dyeing Machine
 
stiffness,Handle,Drape properties of fabric ,Fabric property TTQC-2
stiffness,Handle,Drape properties of fabric ,Fabric property TTQC-2stiffness,Handle,Drape properties of fabric ,Fabric property TTQC-2
stiffness,Handle,Drape properties of fabric ,Fabric property TTQC-2
 
Nonwoven Presentation
Nonwoven PresentationNonwoven Presentation
Nonwoven Presentation
 
Project mercerization
Project mercerizationProject mercerization
Project mercerization
 
Warp knitting design
Warp knitting designWarp knitting design
Warp knitting design
 
Presentation on Textile Finishing
Presentation on Textile FinishingPresentation on Textile Finishing
Presentation on Textile Finishing
 
Resin finishing
Resin finishingResin finishing
Resin finishing
 
Finishing 1: Padding Mangles Stentering machine
Finishing 1: Padding Mangles    Stentering machineFinishing 1: Padding Mangles    Stentering machine
Finishing 1: Padding Mangles Stentering machine
 
Flock printing
Flock printingFlock printing
Flock printing
 
Huckaback weave
Huckaback weaveHuckaback weave
Huckaback weave
 

Viewers also liked

Viewers also liked (14)

Sql injections (Basic bypass authentication)
Sql injections (Basic bypass authentication)Sql injections (Basic bypass authentication)
Sql injections (Basic bypass authentication)
 
Sql Basic Selects
Sql Basic SelectsSql Basic Selects
Sql Basic Selects
 
Sql
SqlSql
Sql
 
4. SQL in DBMS
4. SQL in DBMS4. SQL in DBMS
4. SQL in DBMS
 
Sql Server Basics
Sql Server BasicsSql Server Basics
Sql Server Basics
 
SQL : introduction
SQL : introductionSQL : introduction
SQL : introduction
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
SQL Tutorial - Basic Commands
SQL Tutorial - Basic CommandsSQL Tutorial - Basic Commands
SQL Tutorial - Basic Commands
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
Customer relationship management
Customer relationship managementCustomer relationship management
Customer relationship management
 
Data mining slides
Data mining slidesData mining slides
Data mining slides
 
Data mining
Data miningData mining
Data mining
 
Customer Relationship Management (CRM)
Customer Relationship Management (CRM)Customer Relationship Management (CRM)
Customer Relationship Management (CRM)
 
Crm final ppt
Crm final pptCrm final ppt
Crm final ppt
 

Similar to SQL: The Language of Relational Databases

Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptxSheethal Aji Mani
 
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.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowPavithSingh
 
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
 
SQL Tutorial for BCA-2
SQL Tutorial for BCA-2SQL Tutorial for BCA-2
SQL Tutorial for BCA-2Raj vardhan
 
DBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptxDBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptxjainendraKUMAR55
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxEliasPetros
 
Structured Query Language (SQL).pptx
Structured Query Language (SQL).pptxStructured Query Language (SQL).pptx
Structured Query Language (SQL).pptxEllenGracePorras
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETEAbrar ali
 

Similar to SQL: The Language of Relational Databases (20)

SQL Query
SQL QuerySQL Query
SQL Query
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.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
 
SQL | DML
SQL | DMLSQL | DML
SQL | DML
 
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
 
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...
 
SQL
SQLSQL
SQL
 
2..basic queries.pptx
2..basic queries.pptx2..basic queries.pptx
2..basic queries.pptx
 
Sql commands
Sql commandsSql commands
Sql commands
 
SQL.ppt
SQL.pptSQL.ppt
SQL.ppt
 
SQL Tutorial for BCA-2
SQL Tutorial for BCA-2SQL Tutorial for BCA-2
SQL Tutorial for BCA-2
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
 
Sql presentation 1 by chandan
Sql presentation 1 by chandanSql presentation 1 by chandan
Sql presentation 1 by chandan
 
DBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptxDBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptx
 
Sql slid
Sql slidSql slid
Sql slid
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
 
Structured Query Language (SQL).pptx
Structured Query Language (SQL).pptxStructured Query Language (SQL).pptx
Structured Query Language (SQL).pptx
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 
Introduction to SQL..pdf
Introduction to SQL..pdfIntroduction to SQL..pdf
Introduction to SQL..pdf
 

Recently uploaded

Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
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
 
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
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
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
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 

Recently uploaded (20)

Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
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
 
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
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
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
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 

SQL: The Language of Relational Databases

  • 1.
  • 2. Structure Query Language, more popularly known as SQL is the language that is used in most relational database system. It is also called Structure Query Language because it follows a rigorous set of rules and procedures in answering queries. SQL is a simple and powerful query language that is capable of answering both simple and complex queries. Any query on a single table can be performed by using only two basic operators, namely SELECT and PROJECT.
  • 3.  Data Definition Language (DDL) ◦ Commands that define a database, including creating, altering, and dropping tables and establishing constraints  Data Manipulation Language (DML) ◦ Commands that maintain and query a database  Data Control Language (DCL) ◦ Commands that control a database, including administering privileges and committing data
  • 4. The SQL CREATE DATABASE statement is used to create new SQL database. Syntax: Basic syntax of CREATE DATABASE statement is as follows: SQL> CREATE DATABASE DatabaseName; Example: If you want to create new database <testDB>, then CREATE DATABASE statement would be as follows: SQL> CREATE DATABASE testDB;
  • 5. Creating a basic table involves naming the table and defining its columns and each column's data type. The SQL CREATE TABLE statement is used to create a new table. Syntax: Basic syntax of CREATE TABLE statement is as follows: SQL> CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype, ..... columnN datatype);
  • 6. Example: SQL> CREATE TABLE CUSTOMERS ( ID INT, NAME VARCHAR (20), AGE INT, ADDRESS CHAR (25) , SALARY DECIMAL (18, 2));
  • 7. SQL data type is an attribute that specifies type of data of any object. Each column, variable and expression has related data type in SQL. SQL Server offers 7 categories of data types for your use −  Exact Numeric Data Types  Approximate Numeric Data Types  Date and Time Data Types  Character Strings Data Types  Unicode Character Strings Data Types  Binary Data Types  Misc Data Types
  • 8. The SQL DELETE Query is used to delete the existing records from a table. You can use WHERE clause with DELETE query to delete selected rows, otherwise all the records would be deleted. Syntax: The basic syntax of DELETE query with WHERE clause is as follows: SQL> DELETE FROM table_name WHERE [condition];
  • 9. The SQL DROP TABLE statement is used to remove a table definition and all data, indexes, triggers, constraints, and permission specifications for that table. Syntax: Basic syntax of DROP TABLE statement is as follows: SQL> DROP TABLE table_name;
  • 10. The SQL INSERT INTO Statement is used to add new rows of data to a table in the database. Syntax: There are two basic syntaxes of INSERT INTO statement as follows: SQL> INSERT INTO TABLE_NAME VALUES (value1, value2, value3,...valueN);
  • 11. SQL SELECT statement is used to fetch the data from a database table which returns data in the form of result table. These result tables are called result-sets. Syntax: The basic syntax of SELECT statement is as follows: SQL> SELECT column1, column2, columnN FROM table_name; The basic syntax of SELECT whole table is as follows: SQL> SELECT * FROM table_name;
  • 12. The SQL WHERE clause is used to specify a condition while fetching the data from single table or joining with multiple tables. If the given condition is satisfied then only it returns specific value from the table. You would use WHERE clause to filter the records and fetching only necessary records. The WHERE clause is not only used in SELECT statement, but it is also used in UPDATE, DELETE statement, etc., which we would examine in subsequent chapters. Syntax: The basic syntax of SELECT statement with WHERE clause is as follows: SQL> SELECT column1, column2, columnN FROM table_name WHERE [condition];
  • 13. The SQL UPDATE Query is used to modify the existing records in a table. You can use WHERE clause with UPDATE query to update selected rows otherwise all the rows would be affected. Syntax: The basic syntax of UPDATE query with WHERE clause is as follows: SQL> UPDATE table_name SET column1 = value1, column2 = value2...., columnN = valueN WHERE [condition];
  • 14. The SQL DELETE Query is used to delete the existing records from a table. You can use WHERE clause with DELETE query to delete selected rows, otherwise all the records would be deleted. Syntax: The basic syntax of DELETE query with WHERE clause is as follows: SQL> DELETE FROM table_name WHERE [condition];