• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content







Total Views
Views on SlideShare
Embed Views



3 Embeds 3

http://www.linkedin.com 1
https://twitter.com 1
https://www.linkedin.com 1


Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    DBMS DBMS Presentation Transcript

    • SQL (Structured Query Language) Presented by: Manohar Prasad Specialization: IB+IT Roll No.- 1999/01030003
    • Structured Query Language (SQL) SQL allows user to access data in relational database management systems, such as Oracle, Access, SQL Server, FoxPro, Informix and others, by allowing users to describe the data the user wishes to see. 12/13/11 www.manoharprasad.wordpress.com
    • SQL statements are issued for the purpose of:
      • Data definition - Defining tables and structures in the database .
      • Data manipulation - Inserting new data, Updating existing data, Deleting existing data, and Querying the Database ( Retrieving existing data from the database).
      12/13/11 www.manoharprasad.wordpress.com
    • DDL Statements
      • CREATE - Create new database objects such as tables or views
      • DROP - Drop a database object such as a table, view or index
      • ALTER - Change an existing table, view or index definition
      • GRANT - Allow another user to access database objects such as tables or views (For Data Control )
      • REVOKE - Disallow a user access to database objects such as tables and views (For Data Control )
      12/13/11 www.manoharprasad.wordpress.com
    • DML Statements
      • SELECT - Retrieve data from a database table
      • INSERT - Insert new data into a database table
      • UPDATE - Change the values of some data items in a database table
      • DELETE - Delete rows from a database table
      • TRUNCATE - Delete all rows from a database table (can not be rolled back)
      • COMMIT - Make all recent changes permanent (DML - transactional)
      12/13/11 www.manoharprasad.wordpress.com
      • Creating Tables
      • Tables are defined with the CREATE TABLE command. This command creates an empty table, a table with no rows.
      • Basically defines a table name as describing a
      • set of named columns.
      • Defines the data types and sizes of the
      • columns.
      • Each table must have at least one column.
      12/13/11 www.manoharprasad.wordpress.com
    • The main SQL data types 12/13/11 www.manoharprasad.wordpress.com Type description Oracle SQL variable-length char. string VARCHAR2(l) fixed-length char. string CHAR(l) number NUMBER date DATE
      • Creating a table
              • E.g.:- 1) CREATE TABLE Employee (
              • Emp_No Char(4),
              • Name Varchar2(15),
              • Address Varchar2(15),
              • DOB Date,
              • Salary Number(9,2) );
      12/13/11 www.manoharprasad.wordpress.com
    • Creating table with constrains e.g.:- 2) CREATE TABLE Employee ( Emp_No Char(4) Primary Key, Name Varchar2(15) Not Null, Address Varchar2(15), DOB Date, Salary Number(9,2) Check (Salary > 3500) ); Primary Key Always Salary must be > 3500 Name field Cannot be null 12/13/11 www.manoharprasad.wordpress.com
      • Altering a Table
        • Once created, tables can be altered to accommodate changing needs.
      12/13/11 www.manoharprasad.wordpress.com
            • Eg:- 1) ALTER TABLE Employee
            • ADD Sex char(1);
      + Add new column to the table 12/13/11 www.manoharprasad.wordpress.com
            • 2) ALTER TABLE Employee
            • DROP COLUMN Sex ;
      Delete a existing column from the table 12/13/11 www.manoharprasad.wordpress.com
      • Displaying Table Structure
          • E.g.:- DESCRIBE Employee;
          • Name Null? Type
          • --------------- -------------- -------------
          • EMP_NO NOT NULL CHAR(4)
          • NAME VARCHAR2(15)
          • ADDRESS VARCHAR2(15)
          • DOB DATE
          • SALARY NUMBER(9,2)
          • SEX CHAR(1)
      12/13/11 www.manoharprasad.wordpress.com
    • Entering Values to a table SQL provides the key word INSERT to add data to a table. E.g.:- 1) INSERT INTO Employee VALUES (‘E001’,’Ranjith’,’Matara’,’12-Feb-76’,7400);   12/13/11 www.manoharprasad.wordpress.com
    • Entering Values to a table Naming columns for insert 2) INSERT INTO Employee (Emp_No, Name, Salary) VALUES (‘E001’,’Ranjith’,7400.00); 12/13/11 www.manoharprasad.wordpress.com
    • 12/13/11 www.manoharprasad.wordpress.com