Upload
cornelius-perry
View
213
Download
0
Embed Size (px)
Citation preview
SQLJan 20,2014
DBMS
• Stores data as records, tables etc.
• Accepts data and stores that data for later use
• Uses query languages for searching, sorting, reporting etc and help users to make sense of collected data
• Provides multiuser access to data, along with security features
DBMS
ADVANTAGES
• Reduced updating errors • Systematic storage of data• Improved data access to users through use of query languages • Improved data security • Reduced data entry, storage, and retrieval costs • Helps in development of new applications program
RDBMS• Relational Database Management System
• RDBMS store the data into collection of tables, which might be related by common fields
• A RDBMS is a DBMS in which data is stored in the form of tables
• The relationship among the data is also stored in the form of tables.
Structured Query Language
• SQL stands for Structured Query Language. • SQL is used to communicate with a database.• It is the standard language for relational
database management systems• All SQL statements should end with a ";".
• SQL statements are used to perform tasks like
• Creating new database and tables• Deleting tables• update data on a database• retrieve data from a database etc.
Structured Query Language
Examples• Some common RDBMS that use SQL are: • Oracle, • Microsoft SQL Server, • My SQL • Access etc.
• SQL can be divided into two parts:
• The Data Manipulation Language (DML)
• The Data Definition Language (DDL).
Structured Query Language
Data Definition Language (DDL)
• The DDL part of SQL permits
• database tables to be created or deleted.
• defines indexes (keys),
• specify links between tables,
• imposes constraints between tables.
Data Manipulation Language (DML)
• The DML part of SQL permits
• Retrieving records.
• Updating records
• Adding new records,
• Deleting records etc.
DDL - CREATE TABLE • used to create a new table
• SYNTAX
• CREATE TABLE "table_name"("column 1" "data_type_for_column_1","column 2" "data_type_for_column_2",... )
DDL - CREATE TABLE • EXAMPLE
• CREATE TABLE customer(First_Name char(50),Last_Name char(50),Address char(50),City char(50),Country char(25),Birth_Date date,
Amount number(6)) ;
• Create a table ‘customer’ with fields First_Name, Last_Name, Address, City, Country, Birth_date, amount
DML - Insert into• used to insert a new row in a table
• Syntax:
• INSERT INTO "table_name" ("column1", "column2", ...) VALUES ("value1", "value2", ...)
DML - Insert into• Example:
• INSERT INTO Customers (First_Name ,Last_Name,Address ,City , Country, Birth_Date ,amount) VALUES(‘Roshan’,’Mathew’,’Palayam’,’Trivandrum’,’India’,’19-Jan-76’,2000);
Home Work
• Write SQL statement to create a table called ‘Friends_tb’ with fields Friend_name, Address, Phone, Email, Birthday
• Write Sql statements to Insert any two records