Рет қаралды 69,320
www.gcreddy.co...
Overview of SQL, Structured Query Language Syntax, SQL Data Types, SQL Operators, SQL Built in Functions, SQL Queries and Sub Queries. Data Definition Language, Data Manipulation Language and Data Control Language Commands.
Overview of Structured Query Language
• SQL (Structured Query Language) is a standard language for accessing databases.
• All Relational Database Management Systems like MS Access, MS SQL Server, Oracle, Sybase, MySQL, DB2
use SQL as standard database language.
i. Environment Setup
We can practice SQL Commands in any Database Management System, Install any Database Engine and
practice.
ii. SQL Syntax
• A database contains one or more tables. Each table is identified by a name, Tables contain records (rows.
with data.
• Most of the actions we need to perform on a database are done with SQL statements.
• SQL keywords are Not case sensitive: select is the same as SELECT
• All the SQL statements start with any of the keywords like SELECT, INSERT, UPDATE, DELETE etc...
and all the statements end with a semicolon (;., it is the standard way to separate SQL Statements.
iii. SQL Data Types
• A data type defines what kind of value a column can contain, we have to use data types while creating
database tables, choose a particular data type for a table column based on our requirement.
Example:
Character Data Types
Numeric Data Types
Date and Time Data Types Etc...
• Data Types vary from One Database Management System to another
iv. Operators
Operators are used to perform Arithmetic, Comparison and Logical Operations.
Categories of Operators in SQL
1. Arithmetic Operators
2. Comparison Operators
3. Logical Operators
v SQL Functions
SQL has many built-in functions for performing processing on data.
Categories of Built-in Functions in SQL
1. Aggregate Functions
2. String Functions
3. Date Functions Etc...
vi. Data Definition Language
The Data Definition Language (DDL) is used to create and destroy databases and database objects.
Important Operations
• Create Database
• Use Database (Specify the Database you wish to work with within your DBMS)
• Alter Database
• Drop Table, Drop Database
vii. Data Manipulation Language
The Data Manipulation Language (DML. is used to insert, retrieve and modify database information)
Important Operations
• Insert Records to an existing Table
• Retrieve the specific information from an operational database.
• Modify information contained within a Table.
• Delete information contained within a Table.
viii. Data Control Language
The Data Control Language (DCL) allows database administrators to configure security access to
relational databases.
Important Operations
• Provide access on the Database objects to the Users
• Remove User access rights to the Database Objects
• Deny Permissions to Users.
ix. SQL SELECT Statement
The SELECT statement is used to select data from a database.
• General Selection
• Conditional Selection Etc...
(We use clauses, Operators and keywords...)
x. SQL Joins
The SQL Joins clause is used to combine records from two or more tables in a database.
Different SQL Joins:
1. Inner Join
2. Left Join
3. Right Join
4. Full Join
----------------------------------------------------