Upload
jatin-batra
View
77
Download
1
Embed Size (px)
Citation preview
SQL TRAINING IN AMBALA
What we Learn TodayWhat is SQLWhy SQLBrief History of SQLSQL Commands Types:• DDL• DML• DCL
What is Database
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
1
Advantages of DatabaseTables in databaseOperations on Tables:
• Create• Insert• Display• Delete record• Update• Alter• Delete table
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
2
What is SQL• SQL (Structured Query Language) is a
standardized programming language used for managing relational databases and performing various operations on the data in them. Initially created in the 1970s, SQL is regularly used by database administrators, as well as by developers writing data integration scripts and data analysts looking to set up and run analytical queries.
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
3
Why SQLSQL 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
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
4
A Brief History of SQL 1970 – Dr. Edgar F. "Ted" Codd of IBM is known as the
father of relational databases. He described a relational model for databases.
1974 – Structured Query Language appeared. 1978 – IBM worked to develop Codd's ideas and
released a product named System/R. 1986 – IBM developed the first prototype of
relational database and standardized by ANSI. The first relational database was released by Relational Software which later came to be known as Oracle
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
5
SQL CommandsThe standard SQL commands to interact with relational databases are CREATE, SELECT, INSERT, UPDATE, DELETE and DROP. These commands can be classified into the following groups based on their nature:DDl – Data Definition LanguageDML – Data Manipulation LanguageDCL – Data Control Language
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
6
Data Definition Language
Data Definition Language (DDL) is a standard for commands that define the different structures in a database. DDL statements create, modify, and remove database objects such as tables, indexes, and users. Common DDL statements are CREATE, ALTER, and DROP.
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
7
Commands In DDL
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
8
Command DescriptionCREATE Creates a new table, a view table, or other
object in the database.
ALTER Modifies an existing database object, such as a table
DROP Deletes an entire table, a view table or other objects in the database.
Data Manipulation Language
DML is abbreviation of Data Manipulation Language. It is used to retrieve, store, modify, delete, insert and update data in database. Examples: SELECT, UPDATE, INSERT statements. DDL is abbreviation of Data Definition Language. It is used to create and modify the structure of database objects in database.
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
9
Commands In DMLCommand Description
SELECT Retrieves certain records from one or more tables
INSERT Creates a record or insert values in existing or new table.
UPDATE Modifies the existing record.
DELETE Delete records
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
10
Data Control LanguageA data control language (DCL) is a syntax similar to a computer programming language used to control access to data stored in a database (Authorization). In particular, it is a component of Structured Query Language (SQL). Examples of DCL commands include: GRANT to allow specified users to perform specified tasks.
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
11
Commands In DCL
Command Description
GRANT Gives a privileges to user.
REVOKE Takes back privileges granted from user.
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
12
What is Database A database management system (DBMS) is
system software for creating and managing databases.
A database is a collection of information that is organized so that it can be easily accessed, managed and updated.
Data is organized into rows, columns and tables, and it is indexed to make it easier to find relevant information.
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
13
Example Of Database
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
14
Advantages of Database• Data abstraction and independence• Data security• A locking mechanism for concurrent access• An efficient handler to balance the needs of multiple applications
using the same data• The ability to swiftly recover from crashes and errors, including
restartability and recoverability• Robust data integrity capabilities• Logging and auditing of activity• Simple access using a standard application programming interface
(API)• Uniform administration procedures for data
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
15
Table in a databaseA table is a data structure that organizes information into rows and columns. It can be used to both store and display data in a structured format.• For example, database store data in tables so
that information can be quickly accessed from specific rows.
• Websites often use tables to display multiple rows of data on page.
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
16
Example of Tables
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
17
Commands used in MySQL
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
18
How to create new Table
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
19
Example
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
20
Insert & Display Operation
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
21
Delete Operation
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
22
Update Operation
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
23
Alter Operation
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
24
Delete Table from Database
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
25
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
26
CONTACT US
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
27
BATRA COMPUTER CENTRE
SCO 15, Dayal Bagh, Near Hanuman Mandir, Ambala Cantt. Phn No.: 9729666670,0171-4000670 Email: [email protected] Website: www.batracomputercentre.com
Ph. No. :9729666670,4000670 Website: www.batracomputercentre.com
28