SlideShare a Scribd company logo
1 of 16
SQL Fundamentals
SQL: Structured Query Language is a simple and powerful
language used to create, access, and manipulate data and structure
in the database. SQL is like plain English: easy to understand and to
write. SQL statements into various categories, which are:
•Data Definition Language
•Data Manipulation Language
•Data Control Language.
•Transaction Control Language
•Embedded SQL statements
Data Definition Language (DDL) statements:
Thapar University, Oracle Short Term Course
DDL statements are used to define, alter, or drop database objects.
The following table gives an overview about usage of DDL
statements in ORACLE (a commercially used database):
Data Manipulation Language
(DML) statements
Once the tables have been created, the DML statements enable
users to query or manipulate data in existing schemas objects.
DML statements are normally the most frequently used
commands.
The following table gives an overview about the usage of DML
statements in ORACLE.
Thapar University, Oracle Short Term Course
Data Control Language (DCL)
A privilege can either be granted to a User with the help of
GRANT statement. The privileges assigned can be SELECT,
ALTER, DELETE, EXECUTE, INSERT, INDEX etc. In addition
to granting of privileges, you can also revoke it by using
REVOKE command.
Transaction Control Statements (TCL) statements:
Thapar University, Oracle Short Term Course
TCL statements manage the change made by DML statements, and
group DML statements into transactions. The following table gives
an overview about the usage of TCL statements in ORACLE.
Embedded SQL statements
Thapar University, Oracle Short Term Course
The SQL statements used to incorporate DDL,DML and transaction
control statements within the body of a procedural language
program, are known as Embedded SQL statements. The following
table gives an overview about the usage of Embedded SQL
statements in ORACLE.
Oracle Data types
The information in a database is maintained in the
form of tables and each table consists of rows and
columns, which store data, and therefore this data
must have some data type i.e the type of data,
which is stored in a table.
Data types
The most commonly used data
types
ď‚· char
ď‚· varchar or varchar2
ď‚· number
ď‚· date
ď‚· long
ď‚· long raw/ raw
Let us now briefly describe these data types:
Char(n)
This data type is used to store character strings of fixed size. The size
of the character string is determined by the numeric value of n. This
data type can hold maximum of 255 characters.
When Oracle stores data in a CHAR data type, it will pad the value
stored in the column up to the length of the column as declared by the
table with blanks.
For example: If data type of address field is mentioned as CHAR(40)
and address information of a particular record complete in 20
characters, then remaining 20 characters space is padded with blank
characters.
Varchar(n) / Varchar2(n)
This data type is used to store variable length alphanumeric data. It can
store maximum of 2000 characters. In case of varchar data type, Oracle
will not store padded blank spaces if the value stored in a column
defined is less than length of the column as declared by the table with
data type VARCHAR2.
For example: If data type of address field is mentioned as
VARCHAR(40) and address information of a particular record complete
in 20 characters, then remaining 20 characters space is not padded with
blank characters and memory space of 20 characters is used for some
other purposes and not wasted as padded with blank characters.
Number (p,s)
This data type is used to store numbers fixed or floating point .
The precision (p) determines the length of the data while (s), the scale,
determines the number of places after the decimal.
The NUMBER data type that is used to store number data can be
specified either to store integers or decimals with the addition of a
parenthetical precision indicator.
For example, if you had a column defined to be data type
NUMBER(10,3), the number 546.3832 would be stored as 546.383,
because after the decimal point we can store 3 digits. It can store a
number of 10 digits including a decimal point for example a maximum
number of 999999.999 can be stored with data type of
NUMBER(10,3).
Date
This data type, stores date values in a special format internal to
Oracle.
It offers a great deal of flexibility to users who want to perform
date manipulation operations There are also numerous functions
that handle date operations more complex than simple
arithmetic.
The default format in which date is stored is DD-MON-YY. If
we want to store date in other format then we have to use the
appropriate functions.
Long
The developer can declare columns to be of LONG data type, which
can stores upto 2 gigabytes of alphanumeric text data. The values of
long data type cannot be indexed and normal characters functions such
as SUBSTR cannot be applied to long values.
Long Raw / Raw
It is useful to store graphics and sound files when used in conjunction
with LONG to form the LONG RAW data type, which can
accommodate up to 2 gigabytes of data.
Note: A table cannot contain more than one Long column. They cannot
be indexed and no integrity constraints can be applied on them (except
for NULL and NOT NULL constrain).
Simplified Approach To Oracle
By
Parteek Bhatia

More Related Content

What's hot

Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentationNITISH KUMAR
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramShakila Mahjabin
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra pptGirdharRatne
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database DesignArchit Saxena
 
Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ pptKumar
 
database language ppt.pptx
database language ppt.pptxdatabase language ppt.pptx
database language ppt.pptxAnusha sivakumar
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivityTanmoy Barman
 
Object Oriented Dbms
Object Oriented DbmsObject Oriented Dbms
Object Oriented Dbmsmaryeem
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational modelChirag vasava
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries InformationNishant Munjal
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model IntroductionNishant Munjal
 

What's hot (20)

SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentation
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 
Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ ppt
 
SQL : introduction
SQL : introductionSQL : introduction
SQL : introduction
 
database language ppt.pptx
database language ppt.pptxdatabase language ppt.pptx
database language ppt.pptx
 
Lab2 ddl commands
Lab2 ddl commandsLab2 ddl commands
Lab2 ddl commands
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Basic concept of OOP's
Basic concept of OOP'sBasic concept of OOP's
Basic concept of OOP's
 
Object Oriented Dbms
Object Oriented DbmsObject Oriented Dbms
Object Oriented Dbms
 
Java threads
Java threadsJava threads
Java threads
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Sql dml & tcl 2
Sql   dml & tcl 2Sql   dml & tcl 2
Sql dml & tcl 2
 

Similar to Sql fundamentals

Database Management Lab -SQL Queries
Database Management Lab -SQL Queries Database Management Lab -SQL Queries
Database Management Lab -SQL Queries shamim hossain
 
Sql Basics And Advanced
Sql Basics And AdvancedSql Basics And Advanced
Sql Basics And Advancedrainynovember12
 
DATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEMDATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEMSonia Pahuja
 
chapter-14-sql-commands.pdf
chapter-14-sql-commands.pdfchapter-14-sql-commands.pdf
chapter-14-sql-commands.pdfstudy material
 
Sql server lesson5
Sql server lesson5Sql server lesson5
Sql server lesson5Ala Qunaibi
 
Sql Server Interview Question
Sql Server Interview QuestionSql Server Interview Question
Sql Server Interview Questionpukal rani
 
SQL ppt.pptx
SQL ppt.pptxSQL ppt.pptx
SQL ppt.pptxfa4185561
 
Presentation1
Presentation1Presentation1
Presentation1Jay Patel
 
Anchor data type,cursor data type,array data type
Anchor data type,cursor data type,array data typeAnchor data type,cursor data type,array data type
Anchor data type,cursor data type,array data typedhruv patel
 
R Text-Based Data I/O and Data Frame Access and Manupulation
R Text-Based Data I/O and Data Frame Access and ManupulationR Text-Based Data I/O and Data Frame Access and Manupulation
R Text-Based Data I/O and Data Frame Access and ManupulationIan Cook
 

Similar to Sql fundamentals (20)

Database Management Lab -SQL Queries
Database Management Lab -SQL Queries Database Management Lab -SQL Queries
Database Management Lab -SQL Queries
 
Sql Basics And Advanced
Sql Basics And AdvancedSql Basics And Advanced
Sql Basics And Advanced
 
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
 
DATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEMDATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEM
 
Oracle
OracleOracle
Oracle
 
Dbms Basics
Dbms BasicsDbms Basics
Dbms Basics
 
12 SQL
12 SQL12 SQL
12 SQL
 
12 SQL
12 SQL12 SQL
12 SQL
 
chapter-14-sql-commands.pdf
chapter-14-sql-commands.pdfchapter-14-sql-commands.pdf
chapter-14-sql-commands.pdf
 
Sql server lesson5
Sql server lesson5Sql server lesson5
Sql server lesson5
 
Ankit
AnkitAnkit
Ankit
 
Sql Server Interview Question
Sql Server Interview QuestionSql Server Interview Question
Sql Server Interview Question
 
SQL ppt.pptx
SQL ppt.pptxSQL ppt.pptx
SQL ppt.pptx
 
sql-commands.pdf
sql-commands.pdfsql-commands.pdf
sql-commands.pdf
 
Sql commands
Sql commandsSql commands
Sql commands
 
Sql commands
Sql commandsSql commands
Sql commands
 
Presentation1
Presentation1Presentation1
Presentation1
 
Anchor data type,cursor data type,array data type
Anchor data type,cursor data type,array data typeAnchor data type,cursor data type,array data type
Anchor data type,cursor data type,array data type
 
R Text-Based Data I/O and Data Frame Access and Manupulation
R Text-Based Data I/O and Data Frame Access and ManupulationR Text-Based Data I/O and Data Frame Access and Manupulation
R Text-Based Data I/O and Data Frame Access and Manupulation
 

More from Ravinder Kamboj

Data warehouse,data mining & Big Data
Data warehouse,data mining & Big DataData warehouse,data mining & Big Data
Data warehouse,data mining & Big DataRavinder Kamboj
 
Cost estimation for Query Optimization
Cost estimation for Query OptimizationCost estimation for Query Optimization
Cost estimation for Query OptimizationRavinder Kamboj
 
Query processing and optimization (updated)
Query processing and optimization (updated)Query processing and optimization (updated)
Query processing and optimization (updated)Ravinder Kamboj
 
Normalization of Data Base
Normalization of Data BaseNormalization of Data Base
Normalization of Data BaseRavinder Kamboj
 
Architecture of dbms(lecture 3)
Architecture of dbms(lecture 3)Architecture of dbms(lecture 3)
Architecture of dbms(lecture 3)Ravinder Kamboj
 
Lecture 1&2(rdbms-ii)
Lecture 1&2(rdbms-ii)Lecture 1&2(rdbms-ii)
Lecture 1&2(rdbms-ii)Ravinder Kamboj
 
Relational database management system (rdbms) i
Relational database management system (rdbms) iRelational database management system (rdbms) i
Relational database management system (rdbms) iRavinder Kamboj
 

More from Ravinder Kamboj (14)

Data warehouse,data mining & Big Data
Data warehouse,data mining & Big DataData warehouse,data mining & Big Data
Data warehouse,data mining & Big Data
 
DDBMS
DDBMSDDBMS
DDBMS
 
Cost estimation for Query Optimization
Cost estimation for Query OptimizationCost estimation for Query Optimization
Cost estimation for Query Optimization
 
Query processing and optimization (updated)
Query processing and optimization (updated)Query processing and optimization (updated)
Query processing and optimization (updated)
 
Query processing
Query processingQuery processing
Query processing
 
Normalization of Data Base
Normalization of Data BaseNormalization of Data Base
Normalization of Data Base
 
Architecture of dbms(lecture 3)
Architecture of dbms(lecture 3)Architecture of dbms(lecture 3)
Architecture of dbms(lecture 3)
 
Lecture 1&2(rdbms-ii)
Lecture 1&2(rdbms-ii)Lecture 1&2(rdbms-ii)
Lecture 1&2(rdbms-ii)
 
Java script
Java scriptJava script
Java script
 
File Management
File ManagementFile Management
File Management
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
DHTML
DHTMLDHTML
DHTML
 
CSA lecture-1
CSA lecture-1CSA lecture-1
CSA lecture-1
 
Relational database management system (rdbms) i
Relational database management system (rdbms) iRelational database management system (rdbms) i
Relational database management system (rdbms) i
 

Recently uploaded

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
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
 
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
 
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
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
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
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
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
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
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
 
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
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
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
 
“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
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 

Recently uploaded (20)

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
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
 
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
 
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
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
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
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
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
 
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
 
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
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
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
 
“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...
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 

Sql fundamentals

  • 1. SQL Fundamentals SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database. SQL is like plain English: easy to understand and to write. SQL statements into various categories, which are: •Data Definition Language •Data Manipulation Language •Data Control Language. •Transaction Control Language •Embedded SQL statements
  • 2. Data Definition Language (DDL) statements: Thapar University, Oracle Short Term Course DDL statements are used to define, alter, or drop database objects. The following table gives an overview about usage of DDL statements in ORACLE (a commercially used database):
  • 3. Data Manipulation Language (DML) statements Once the tables have been created, the DML statements enable users to query or manipulate data in existing schemas objects. DML statements are normally the most frequently used commands. The following table gives an overview about the usage of DML statements in ORACLE.
  • 4.
  • 5. Thapar University, Oracle Short Term Course Data Control Language (DCL) A privilege can either be granted to a User with the help of GRANT statement. The privileges assigned can be SELECT, ALTER, DELETE, EXECUTE, INSERT, INDEX etc. In addition to granting of privileges, you can also revoke it by using REVOKE command.
  • 6. Transaction Control Statements (TCL) statements: Thapar University, Oracle Short Term Course TCL statements manage the change made by DML statements, and group DML statements into transactions. The following table gives an overview about the usage of TCL statements in ORACLE.
  • 7. Embedded SQL statements Thapar University, Oracle Short Term Course The SQL statements used to incorporate DDL,DML and transaction control statements within the body of a procedural language program, are known as Embedded SQL statements. The following table gives an overview about the usage of Embedded SQL statements in ORACLE.
  • 8. Oracle Data types The information in a database is maintained in the form of tables and each table consists of rows and columns, which store data, and therefore this data must have some data type i.e the type of data, which is stored in a table.
  • 10. The most commonly used data types ď‚· char ď‚· varchar or varchar2 ď‚· number ď‚· date ď‚· long ď‚· long raw/ raw
  • 11. Let us now briefly describe these data types: Char(n) This data type is used to store character strings of fixed size. The size of the character string is determined by the numeric value of n. This data type can hold maximum of 255 characters. When Oracle stores data in a CHAR data type, it will pad the value stored in the column up to the length of the column as declared by the table with blanks. For example: If data type of address field is mentioned as CHAR(40) and address information of a particular record complete in 20 characters, then remaining 20 characters space is padded with blank characters.
  • 12. Varchar(n) / Varchar2(n) This data type is used to store variable length alphanumeric data. It can store maximum of 2000 characters. In case of varchar data type, Oracle will not store padded blank spaces if the value stored in a column defined is less than length of the column as declared by the table with data type VARCHAR2. For example: If data type of address field is mentioned as VARCHAR(40) and address information of a particular record complete in 20 characters, then remaining 20 characters space is not padded with blank characters and memory space of 20 characters is used for some other purposes and not wasted as padded with blank characters.
  • 13. Number (p,s) This data type is used to store numbers fixed or floating point . The precision (p) determines the length of the data while (s), the scale, determines the number of places after the decimal. The NUMBER data type that is used to store number data can be specified either to store integers or decimals with the addition of a parenthetical precision indicator. For example, if you had a column defined to be data type NUMBER(10,3), the number 546.3832 would be stored as 546.383, because after the decimal point we can store 3 digits. It can store a number of 10 digits including a decimal point for example a maximum number of 999999.999 can be stored with data type of NUMBER(10,3).
  • 14. Date This data type, stores date values in a special format internal to Oracle. It offers a great deal of flexibility to users who want to perform date manipulation operations There are also numerous functions that handle date operations more complex than simple arithmetic. The default format in which date is stored is DD-MON-YY. If we want to store date in other format then we have to use the appropriate functions.
  • 15. Long The developer can declare columns to be of LONG data type, which can stores upto 2 gigabytes of alphanumeric text data. The values of long data type cannot be indexed and normal characters functions such as SUBSTR cannot be applied to long values. Long Raw / Raw It is useful to store graphics and sound files when used in conjunction with LONG to form the LONG RAW data type, which can accommodate up to 2 gigabytes of data. Note: A table cannot contain more than one Long column. They cannot be indexed and no integrity constraints can be applied on them (except for NULL and NOT NULL constrain).
  • 16. Simplified Approach To Oracle By Parteek Bhatia