ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
LECTURE -2
S T R U C T U R E D Q U E R Y L A N G U A G E
( B A S I C S )
D e l i v e r e d B y :
M r . S h u b h a m S h u k l a
WHAT IS SQL?
SQL is Structured Query Language, which is a computer language for storing,
manipulating and retrieving data stored in a relational database.
Why SQL?
SQL is widely popular because it offers the following advantages:
• Allows users to access data in the relational database management systems.
• Allows users to describe the data.
• Allows users to define the data in a database and manipulate that data.
• Allows to embed within other languages using SQL modules, libraries & pre-
compilers.
• Allows users to create and drop databases and tables.
• Allows users to create view, stored procedure, functions in a database.
• Allows users to set permissions on tables, procedures and views.
SQL Process
• When you are executing an SQL command for any RDBMS, the system
determines the best way to carry out your request and SQL engine figures out
how to interpret the task. There are various components included in this
process.
These components are –
Query Dispatcher
Optimization Engines
Classic Query Engine
SQL Query Engine, etc.
• A classic query engine handles all the non-SQL queries, but a SQL query
engine won't handle logical files.
• Following is a simple diagram showing the SQL Architecture:
SQL CONSTRAINTS
• NOT NULL Constraint: Ensures that a column cannot have a NULL value.
• DEFAULT Constraint: Provides a default value for a column when none is
specified.
• UNIQUE Constraint: Ensures that all the values in a column are different.
• PRIMARY Key: Uniquely identifies each row/record in a database table.
• FOREIGN Key: Uniquely identifies a row/record in any another database
table.
• CHECK Constraint: The CHECK constraint ensures that all values in a
column satisfy certain conditions.
• INDEX: Used to create and retrieve data from the database very quickly.
DATA INTEGRITY
• The following categories of data integrity exist with each RDBMS:
Entity Integrity: There are no duplicate rows in a table.
Domain Integrity: Enforces valid entries for a given column by
restricting the type, the format, or the range of values.
Referential integrity: Rows cannot be deleted, which are used by other
records.
User-Defined Integrity: Enforces some specific business rules that do
not fall into entity, domain or referential integrity.
SQL - DATA TYPES
Character Datatypes:
The following are the Character Datatypes in Oracle/PLSQL:
Numeric Datatypes
The following are the Numeric Datatypes in Oracle/PLSQL:
Date/Time Datatypes
The following are the Date/Time Datatypes in Oracle/PLSQL:
Large Object (LOB) Datatypes
The following are the LOB Datatypes in Oracle/PLSQL:
Rowid Datatypes
The following are the Rowid Datatypes in Oracle/PLSQL:
SQL LOGICAL OPERATORS
• Data Definition Language (DDL):
– Commands that define a database - Create, Alter, Drop
• 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.
TYPES OF SQL COMMANDS:
THANK YOU

More Related Content

Lecture 2 sql {basics date type, constrains , integrity types etc.}

  • 1. LECTURE -2 S T R U C T U R E D Q U E R Y L A N G U A G E ( B A S I C S ) D e l i v e r e d B y : M r . S h u b h a m S h u k l a
  • 2. WHAT IS SQL? SQL is Structured Query Language, which is a computer language for storing, manipulating and retrieving data stored in a relational database. Why SQL? SQL is widely popular because it offers the following advantages: • Allows users to access data in the relational database management systems. • Allows users to describe the data. • Allows users to define the data in a database and manipulate that data. • Allows to embed within other languages using SQL modules, libraries & pre- compilers. • Allows users to create and drop databases and tables. • Allows users to create view, stored procedure, functions in a database. • Allows users to set permissions on tables, procedures and views.
  • 3. SQL Process • When you are executing an SQL command for any RDBMS, the system determines the best way to carry out your request and SQL engine figures out how to interpret the task. There are various components included in this process. These components are – Query Dispatcher Optimization Engines Classic Query Engine SQL Query Engine, etc. • A classic query engine handles all the non-SQL queries, but a SQL query engine won't handle logical files.
  • 4. • Following is a simple diagram showing the SQL Architecture:
  • 5. SQL CONSTRAINTS • NOT NULL Constraint: Ensures that a column cannot have a NULL value. • DEFAULT Constraint: Provides a default value for a column when none is specified. • UNIQUE Constraint: Ensures that all the values in a column are different. • PRIMARY Key: Uniquely identifies each row/record in a database table. • FOREIGN Key: Uniquely identifies a row/record in any another database table. • CHECK Constraint: The CHECK constraint ensures that all values in a column satisfy certain conditions. • INDEX: Used to create and retrieve data from the database very quickly.
  • 6. DATA INTEGRITY • The following categories of data integrity exist with each RDBMS: Entity Integrity: There are no duplicate rows in a table. Domain Integrity: Enforces valid entries for a given column by restricting the type, the format, or the range of values. Referential integrity: Rows cannot be deleted, which are used by other records. User-Defined Integrity: Enforces some specific business rules that do not fall into entity, domain or referential integrity.
  • 7. SQL - DATA TYPES Character Datatypes: The following are the Character Datatypes in Oracle/PLSQL:
  • 8. Numeric Datatypes The following are the Numeric Datatypes in Oracle/PLSQL:
  • 9. Date/Time Datatypes The following are the Date/Time Datatypes in Oracle/PLSQL:
  • 10. Large Object (LOB) Datatypes The following are the LOB Datatypes in Oracle/PLSQL:
  • 11. Rowid Datatypes The following are the Rowid Datatypes in Oracle/PLSQL:
  • 13. • Data Definition Language (DDL): – Commands that define a database - Create, Alter, Drop • 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. TYPES OF SQL COMMANDS: