SlideShare una empresa de Scribd logo
1 de 27
RDBMS LAB-1
Learning Objectives

    Introduction to SQL

    Concept of Table and Relation

    Oracle Classification of SQL

    Table Creation,Data Insertion,Data Retrieval,Table
    Structure Modification,Data Deletion and Table
    Deletion
                                                             Prepared by:
                                                             Akshaya Kumar Dash
                                                             Sasmita Mishra
                   Copyright@2012 Trident Academy of Technology              1
Structured Query Language(SQL)
   SQL is a database computer language designed for the
    retrieval and management of data in relational database.
   SQL is structured Query Language which is a computer
    language for storing, manipulating and retrieving data
    stored in relational database.
   SQL is the standard language for Relation Database
    System. All relational database management systems
    like MySQL, MS Access, Oracle, Sybase, Informix,
    postgres and SQL Server uses SQL as standard database
    language.
                     Copyright@2012 Trident Academy of Technology   2
Why SQL
•Allows users to access data in relational database
 management Systems.
•Allow users to describe the data.
•Allow users to define data in database and manipulate

 that data.
•Allow to embed within other languages using SQL

 modules, libraries & pre-compilers.
•Allow users to create and drop databases and tables.
•Allow users to create view, stored procedure, functions

  in a database.
•Allow users to set permissions on tables, procedures,

 and views        Copyright@2012 Trident Academy of Technology 3
Requirements to learn Oracle
          SQL

  A Computer with following
           Softwares
    OS:Windows or Linux
DB:Oracle 9i or any other Higher
            version

         Copyright@2012 Trident Academy of Technology   4
Books

Beginnig   SQL by Paul Wilton
SQL Bible by Alex Kriegel
SQL for dummies
Head First SQL
SQL,PL/SQL The Programming Language of
  Oracle by Ivan Bayross(Available in Library)
You need not a buy a single book(only Bikalp is
 the lab classes or internet)

                Copyright@2012 Trident Academy of Technology   5
Oracle has grouped the commands of SQL into the
following five sublanguages.

DDL(Data Definition Language):
Create,Alter,Drop,Rename,Truncate
DML(Data Manipulation Language)

Insert,Update,Delete
DQL(Data Query Language)

Select
DCL(Data Control Language)

Grant,Revoke
TCL(Transcation Control Language)

Rollback,Savepoint
                Copyright@2012 Trident Academy of Technology   6
Relation and Tables
In relational database systems (DBS) data are
represented using tables (relations). A query
issued against the DBS also results in a table. A
table has the following structure:




                Copyright@2012 Trident Academy of Technology   7
A table is uniquely identied by its name and
consists of rows that contain the stored
information, each row containing exactly one
tuple (or record).
A table can have one or more columns.
A column is made up of a column name and a

data type, and it describes an attribute of the
tuples. The structure of a table, also called
relation schema, thus is dened by its attributes.
The type of information to be stored in a table is

defined by the data types of the attributes at table
creation time.
                 Copyright@2012 Trident Academy of Technology   8
Oracle Data Types
char(n): Fixed-length character data (string), n characters long. The
  maximum size for n is 255 bytes (2000 in Oracle8). Note that a string of
  type char is always padded on right with blanks to full length of n.
Example: char(40)
varchar2(n): Variable-length character string. The maximum size for n is

   2000 (4000 in Oracle8). Only the bytes used for a string require
   storage.
Example: varchar2(80)
number(o, d): Numeric data type for integers and reals. o = overall

  number of digits, d = number of digits to the right of the decimal point.
Maximum values: o =38, d= -84 to +127. Examples: number(8),
 number(5,2)
Note that, e.g., number(5,2) cannot contain anything larger than 999.99
without resulting in an error. Data types derived from number are
int[eger], dec[imal], smallint and real.
date: Date data type for storing date and time.The default format for a

  date is: DD-MMM-YY. Examples: Trident Academy of Technology
                           Copyright@2012 '13-OCT-94', '07-JAN-98'       9
Create Command
Create Command Syntax:
CREATE TABLE table-name
{
Column-name-1 data-type-1 [constraint],
Column-name-1 data-type-2 [constraint],
Column-name-1 data-type-3 [constraint]
};


eg->
CREATE TABLE student(regd_no number(10),student_name varchar2(30),cgpa
  decimal(5,3),branch varchar2(10),mob_no number(10));
                         Copyright@2012 Trident Academy of Technology   10
Describe Command will Display the column
names and corressponding data types present in
the table.
describe table-name;
Desc table-name;

eg:
desc student



              Copyright@2012 Trident Academy of Technology   11
Insert Command
It can be executed in the following three ways

    Insert into table-name
    values(value1,value2,....,valuen);

    Insert into table-name (col1,col2,...,coln) values
    (value1,value2,...,valuen);

    Insert into table-name
    values(&col1,&col2,...,&coln);


                    Copyright@2012 Trident Academy of Technology   12
View the content of table
SELECT STATEMENT Syntax:
SELECT col1,col2,col3,...,coln
FROM table-1,...,table-n
[WHERE condition]
[ORDER BY col1 [ASC|DESC] [, col2 [ASC|
  DESC] ...]];



                Copyright@2012 Trident Academy of Technology   13
SELECT CONTINUED...
The SELECT Clause lists the columns to display.
The FROM clause lists the tables from which to obtain
 the data
The WHERE clause specifies the condition or
 conditions that need to be satisfied by the rows of
 the tables indicated in the FROM clause
The ORDER BY clause indicates the criterion or
 criteria used to sort rows that satisfy WHERE clause

                Copyright@2012 Trident Academy of Technology   14
Where Clause
The Conditions are of the following form
Column-name comparisonoperator single-value

        Comparison Operators       Description
        =                          Equal to
        <>                         Not equal to
        <                          Less than
        <=                         Less than or equal to
        >                          Greater than
        >=                         Greater than or equal to



                   Copyright@2012 Trident Academy of Technology   15
ALTER COMMAND

    One can add a new column,drop an existing
    column,modify the datatype of a column,and drop
    the constraints using the following commands
    respectively.


    ALTER TABLE table_name ADD COLUMN_name datatype;

    ALTER TABLE table_name DROP COLUMN column_name;

    ALTER TABLE table_name MODIFY (column_name,datatype);

    ALTER TABLE table_name DROP CONSTRAINT constraint_name;


                    Copyright@2012 Trident Academy of Technology   16
TRUNCATE COMMAND

    TRUNCATE will remove all the rows of a table
TRUNCATE TABLE table-name;
Note:

    We can't truncate the rows of a table if there are
    referential integrity constraints for which this table
    is parent table.

    We can't roolback a TRUNCATE statement


                    Copyright@2012 Trident Academy of Technology   17
DROP COMMAND
DROP command will permanently delete the table
 with all its data


DROP TABLE table-name [CASCADE
 CONSTRAINT];




               Copyright@2012 Trident Academy of Technology   18
Lab Assignment-1
Create the follwing tables

    branch(branch_name,branch_city,assets)

    customer(customer_name,customer_street,customer
    _city)

    loan(loan_number,branch_name,amount)

    borrower(customer_name,loan_number)

    account(account_number,branch_name,balance)

    depositor(customer_name,account_number)

                  Copyright@2012 Trident Academy of Technology   19
Assignment Continued..

    Populate the branch table with the following data
          branch_name          branch_city               assets
          Brighton             Brooklyn                  7100000
          Downtown             Brooklyn                  9000000
          Mianus               Horseneck                 400000
          North Town           Rye                       3700000
          Perryridge           Horseneck                 1700000
          Pownal               Bennington                300000
          Redwood              Palo Alto                 2100000
          Round Hill           Horseneck                 8000000



                       Copyright@2012 Trident Academy of Technology   20
Assignment Continued..

    Populate the customer table with the following data
          Customer_name       Customer_street           Customer_city
          Adams               Spring                    Pittsfield
          Brooks              Senator                   Brooklyn
          Curry               North                     Rye
          Glenn               Sand Hill                 Woodside
          Green               Walnut                    Stamford
          Hayes               Main                      Harrison
          Johnson             Alma                      Palo Alto
          Jones               Main                      Harrison
          Lindsay             Park                      Pittsfield
          Smith               North                     Rye
          Turner              Putnam                    Stamford
          Williams            Nassau                    Princeton

                     Copyright@2012 Trident Academy of Technology       21
Assignment Continued..

    Populate the loan table with the following data
           loan_number       branch_name             amount

           L-11              Round Hill              900

           L-14              Downtown                1500

           L-15              Perryridge              1500

           L-16              Perryridge              1300

           L-17              Downtown                1000

           L-23              Redwood                 2000

           L-93              Mianus                  500


                     Copyright@2012 Trident Academy of Technology   22
Assignment Continued...

    Populate the borrower realtion the following data

              Customer_name                 loan_number
              Adams                         L-16
              Curry                         L-93
              Hayes                         L-15
              Jackson                       L-14
              Jones                         L-17
              Smith                         L-11
              Smith                         L-23
              Williams                      L-17



                        Copyright@2012 Trident Academy of Technology   23
Assignment Continued...

    Populate account relation with the following data
          account_number branch_name               balance
          A-101          Downtown                  500
          A-215           Mianus                   700
          A-102           Perryridge               400
          A-305           Round Hill               350
          A-201           Brighton                 900
          A-222           Redwood                  700
          A-217           Brighton                 750




                    Copyright@2012 Trident Academy of Technology   24
Assignment Continued...

    Populate the depositor relation with the following
    data
                Customer_name               account_number
                Hayes                       A-102
                Johnson                     A-101
                Johnson                     A-201
                Jones                       A-217
                Lindsay                     A-222
                Smith                       A-215
                Turner                      A-305




                   Copyright@2012 Trident Academy of Technology   25
Create One more table
Create a student table with the following data
           Regdno         Student_name Branch
           1001           Surya        CSE
           1002           Binaya              ETC
           1003           Arup                CSE


   Add   the CGPA Column, to the student table (the
   type must be a floating point type)
   Drop CGPA column
   Modify the existing type of regdno.
   Rename student to student_trident
   Now delete all the data present in the student_trident
     table.
   Drop the table
                    Copyright@2012 Trident Academy of Technology   26
Thank You




Copyright@2012 Trident Academy of Technology   27

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Dbms lab Manual
Dbms lab ManualDbms lab Manual
Dbms lab Manual
 
Sql notes, sql server,sql queries,introduction of SQL, Beginner in SQL
Sql notes, sql server,sql queries,introduction of SQL, Beginner in SQLSql notes, sql server,sql queries,introduction of SQL, Beginner in SQL
Sql notes, sql server,sql queries,introduction of SQL, Beginner in SQL
 
SQL Tutorial for BCA-2
SQL Tutorial for BCA-2SQL Tutorial for BCA-2
SQL Tutorial for BCA-2
 
Database concepts
Database conceptsDatabase concepts
Database concepts
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
Sq lite module6
Sq lite module6Sq lite module6
Sq lite module6
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
Sql Server 2000
Sql Server 2000Sql Server 2000
Sql Server 2000
 
Sql commands
Sql commandsSql commands
Sql commands
 
Sql – Structured Query Language
Sql – Structured Query LanguageSql – Structured Query Language
Sql – Structured Query Language
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introduction
 
DML using oracle
 DML using oracle DML using oracle
DML using oracle
 
BIS05 Introduction to SQL
BIS05 Introduction to SQLBIS05 Introduction to SQL
BIS05 Introduction to SQL
 
Sql
SqlSql
Sql
 
SQL
SQLSQL
SQL
 
Sql 2009
Sql 2009Sql 2009
Sql 2009
 
SQL Server Learning Drive
SQL Server Learning Drive SQL Server Learning Drive
SQL Server Learning Drive
 
Sql intro & ddl 1
Sql intro & ddl 1Sql intro & ddl 1
Sql intro & ddl 1
 
SQL DDL
SQL DDLSQL DDL
SQL DDL
 
lovely
lovelylovely
lovely
 

Destacado

Dr archana dhawan bajaj eol ir-deb_file_07a
Dr archana dhawan bajaj   eol ir-deb_file_07aDr archana dhawan bajaj   eol ir-deb_file_07a
Dr archana dhawan bajaj eol ir-deb_file_07aDr-archana-dhawan-bajaj
 
FedEx Domestic Services Regular Pin-Codes List
FedEx Domestic Services Regular Pin-Codes ListFedEx Domestic Services Regular Pin-Codes List
FedEx Domestic Services Regular Pin-Codes ListZepoDOTin
 
Pin code all indian cities
Pin code all indian citiesPin code all indian cities
Pin code all indian citiesHarsha Halyal
 
Sql interview questions and answers
Sql interview questions and  answersSql interview questions and  answers
Sql interview questions and answerssheibansari
 
Training MS Access 2007
Training MS Access 2007Training MS Access 2007
Training MS Access 2007crespoje
 
Top 100 SQL Interview Questions and Answers
Top 100 SQL Interview Questions and AnswersTop 100 SQL Interview Questions and Answers
Top 100 SQL Interview Questions and Answersiimjobs and hirist
 
Sql queries with answers
Sql queries with answersSql queries with answers
Sql queries with answersvijaybusu
 

Destacado (11)

Dr archana dhawan bajaj eol ir-deb_file_07a
Dr archana dhawan bajaj   eol ir-deb_file_07aDr archana dhawan bajaj   eol ir-deb_file_07a
Dr archana dhawan bajaj eol ir-deb_file_07a
 
FedEx Domestic Services Regular Pin-Codes List
FedEx Domestic Services Regular Pin-Codes ListFedEx Domestic Services Regular Pin-Codes List
FedEx Domestic Services Regular Pin-Codes List
 
Pin code all indian cities
Pin code all indian citiesPin code all indian cities
Pin code all indian cities
 
Sql interview questions and answers
Sql interview questions and  answersSql interview questions and  answers
Sql interview questions and answers
 
Dbms lab questions
Dbms lab questionsDbms lab questions
Dbms lab questions
 
Ms access 2007
Ms access 2007Ms access 2007
Ms access 2007
 
Training MS Access 2007
Training MS Access 2007Training MS Access 2007
Training MS Access 2007
 
Top 100 SQL Interview Questions and Answers
Top 100 SQL Interview Questions and AnswersTop 100 SQL Interview Questions and Answers
Top 100 SQL Interview Questions and Answers
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
Sql queries with answers
Sql queries with answersSql queries with answers
Sql queries with answers
 
Vrl branch list
Vrl branch listVrl branch list
Vrl branch list
 

Similar a Sql

MS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutionsMS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutionsRSolutions
 
6_SQL.pdf
6_SQL.pdf6_SQL.pdf
6_SQL.pdfLPhct2
 
What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?CPD INDIA
 
Structured query language
Structured query languageStructured query language
Structured query languageRashid Ansari
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptDrRShaliniVISTAS
 
Database Management Lab -SQL Queries
Database Management Lab -SQL Queries Database Management Lab -SQL Queries
Database Management Lab -SQL Queries shamim hossain
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxEliasPetros
 
BCS4L1-Database Management lab.pdf
BCS4L1-Database Management lab.pdfBCS4L1-Database Management lab.pdf
BCS4L1-Database Management lab.pdfKeerthanaP37
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETEAbrar ali
 
Manage schema object.ppt
Manage schema object.pptManage schema object.ppt
Manage schema object.pptAhmadUsman79
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...SakkaravarthiS1
 
dbs class 7.ppt
dbs class 7.pptdbs class 7.ppt
dbs class 7.pptMARasheed3
 

Similar a Sql (20)

Lab
LabLab
Lab
 
MS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutionsMS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutions
 
6_SQL.pdf
6_SQL.pdf6_SQL.pdf
6_SQL.pdf
 
Db1 lecture4
Db1 lecture4Db1 lecture4
Db1 lecture4
 
SQL2.pptx
SQL2.pptxSQL2.pptx
SQL2.pptx
 
4.Database Management System.pdf
4.Database Management System.pdf4.Database Management System.pdf
4.Database Management System.pdf
 
What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?
 
Structured query language
Structured query languageStructured query language
Structured query language
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
 
Database Management Lab -SQL Queries
Database Management Lab -SQL Queries Database Management Lab -SQL Queries
Database Management Lab -SQL Queries
 
Introduction to (sql)
Introduction to (sql)Introduction to (sql)
Introduction to (sql)
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
 
Basic SQL and History
 Basic SQL and History Basic SQL and History
Basic SQL and History
 
BCS4L1-Database Management lab.pdf
BCS4L1-Database Management lab.pdfBCS4L1-Database Management lab.pdf
BCS4L1-Database Management lab.pdf
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 
Manage schema object.ppt
Manage schema object.pptManage schema object.ppt
Manage schema object.ppt
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
 
dbs class 7.ppt
dbs class 7.pptdbs class 7.ppt
dbs class 7.ppt
 
Module02
Module02Module02
Module02
 

Último

Dark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls DubaiDark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls Dubaikojalkojal131
 
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineResumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineBruce Bennett
 
Nandini Layout Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Nandini Layout Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Nandini Layout Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Nandini Layout Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...amitlee9823
 
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...sonalitrivedi431
 
CFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceCFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceSanjay Bokadia
 
Personal Brand Exploration - Fernando Negron
Personal Brand Exploration - Fernando NegronPersonal Brand Exploration - Fernando Negron
Personal Brand Exploration - Fernando Negronnegronf24
 
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangaloreamitlee9823
 
Toxicokinetics studies.. (toxicokinetics evaluation in preclinical studies)
Toxicokinetics studies.. (toxicokinetics evaluation in preclinical studies)Toxicokinetics studies.. (toxicokinetics evaluation in preclinical studies)
Toxicokinetics studies.. (toxicokinetics evaluation in preclinical studies)sonalinghatmal
 
Dombivli Call Girls, 9892124323, Kharghar Call Girls, chembur Call Girls, Vas...
Dombivli Call Girls, 9892124323, Kharghar Call Girls, chembur Call Girls, Vas...Dombivli Call Girls, 9892124323, Kharghar Call Girls, chembur Call Girls, Vas...
Dombivli Call Girls, 9892124323, Kharghar Call Girls, chembur Call Girls, Vas...Pooja Nehwal
 
0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf
0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf
0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdfssuserded2d4
 
WhatsApp 📞 8448380779 ✅Call Girls In Salarpur Sector 81 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Salarpur Sector 81 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Salarpur Sector 81 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Salarpur Sector 81 ( Noida)Delhi Call girls
 
Joshua Minker Brand Exploration Sports Broadcaster .pptx
Joshua Minker Brand Exploration Sports Broadcaster .pptxJoshua Minker Brand Exploration Sports Broadcaster .pptx
Joshua Minker Brand Exploration Sports Broadcaster .pptxsportsworldproductio
 
Call Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Résumé (2 pager - 12 ft standard syntax)
Résumé (2 pager -  12 ft standard syntax)Résumé (2 pager -  12 ft standard syntax)
Résumé (2 pager - 12 ft standard syntax)Soham Mondal
 
Bur Dubai Call Girl Service #$# O56521286O Call Girls In Bur Dubai
Bur Dubai Call Girl Service #$# O56521286O Call Girls In Bur DubaiBur Dubai Call Girl Service #$# O56521286O Call Girls In Bur Dubai
Bur Dubai Call Girl Service #$# O56521286O Call Girls In Bur Dubaiparisharma5056
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Sa...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Sa...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Sa...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Sa...Pooja Nehwal
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceanilsa9823
 
OSU毕业证留学文凭,制做办理
OSU毕业证留学文凭,制做办理OSU毕业证留学文凭,制做办理
OSU毕业证留学文凭,制做办理cowagem
 
Production Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbjProduction Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbjLewisJB
 

Último (20)

Dark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls DubaiDark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls Dubai
 
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Delhi 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineResumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying Online
 
Nandini Layout Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Nandini Layout Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Nandini Layout Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Nandini Layout Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
 
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
 
CFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector ExperienceCFO_SB_Career History_Multi Sector Experience
CFO_SB_Career History_Multi Sector Experience
 
Personal Brand Exploration - Fernando Negron
Personal Brand Exploration - Fernando NegronPersonal Brand Exploration - Fernando Negron
Personal Brand Exploration - Fernando Negron
 
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hosur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Toxicokinetics studies.. (toxicokinetics evaluation in preclinical studies)
Toxicokinetics studies.. (toxicokinetics evaluation in preclinical studies)Toxicokinetics studies.. (toxicokinetics evaluation in preclinical studies)
Toxicokinetics studies.. (toxicokinetics evaluation in preclinical studies)
 
Dombivli Call Girls, 9892124323, Kharghar Call Girls, chembur Call Girls, Vas...
Dombivli Call Girls, 9892124323, Kharghar Call Girls, chembur Call Girls, Vas...Dombivli Call Girls, 9892124323, Kharghar Call Girls, chembur Call Girls, Vas...
Dombivli Call Girls, 9892124323, Kharghar Call Girls, chembur Call Girls, Vas...
 
0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf
0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf
0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf0425-GDSC-TMU.pdf
 
WhatsApp 📞 8448380779 ✅Call Girls In Salarpur Sector 81 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Salarpur Sector 81 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Salarpur Sector 81 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Salarpur Sector 81 ( Noida)
 
Joshua Minker Brand Exploration Sports Broadcaster .pptx
Joshua Minker Brand Exploration Sports Broadcaster .pptxJoshua Minker Brand Exploration Sports Broadcaster .pptx
Joshua Minker Brand Exploration Sports Broadcaster .pptx
 
Call Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Alandi Road Call Me 7737669865 Budget Friendly No Advance Booking
 
Résumé (2 pager - 12 ft standard syntax)
Résumé (2 pager -  12 ft standard syntax)Résumé (2 pager -  12 ft standard syntax)
Résumé (2 pager - 12 ft standard syntax)
 
Bur Dubai Call Girl Service #$# O56521286O Call Girls In Bur Dubai
Bur Dubai Call Girl Service #$# O56521286O Call Girls In Bur DubaiBur Dubai Call Girl Service #$# O56521286O Call Girls In Bur Dubai
Bur Dubai Call Girl Service #$# O56521286O Call Girls In Bur Dubai
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Sa...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Sa...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Sa...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Sa...
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
 
OSU毕业证留学文凭,制做办理
OSU毕业证留学文凭,制做办理OSU毕业证留学文凭,制做办理
OSU毕业证留学文凭,制做办理
 
Production Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbjProduction Day 1.pptxjvjbvbcbcb bj bvcbj
Production Day 1.pptxjvjbvbcbcb bj bvcbj
 

Sql

  • 1. RDBMS LAB-1 Learning Objectives  Introduction to SQL  Concept of Table and Relation  Oracle Classification of SQL  Table Creation,Data Insertion,Data Retrieval,Table Structure Modification,Data Deletion and Table Deletion Prepared by: Akshaya Kumar Dash Sasmita Mishra Copyright@2012 Trident Academy of Technology 1
  • 2. Structured Query Language(SQL)  SQL is a database computer language designed for the retrieval and management of data in relational database.  SQL is structured Query Language which is a computer language for storing, manipulating and retrieving data stored in relational database.  SQL is the standard language for Relation Database System. All relational database management systems like MySQL, MS Access, Oracle, Sybase, Informix, postgres and SQL Server uses SQL as standard database language. Copyright@2012 Trident Academy of Technology 2
  • 3. Why SQL •Allows users to access data in relational database management Systems. •Allow users to describe the data. •Allow users to define data in database and manipulate that data. •Allow to embed within other languages using SQL modules, libraries & pre-compilers. •Allow users to create and drop databases and tables. •Allow users to create view, stored procedure, functions in a database. •Allow users to set permissions on tables, procedures, and views Copyright@2012 Trident Academy of Technology 3
  • 4. Requirements to learn Oracle SQL A Computer with following Softwares OS:Windows or Linux DB:Oracle 9i or any other Higher version Copyright@2012 Trident Academy of Technology 4
  • 5. Books Beginnig SQL by Paul Wilton SQL Bible by Alex Kriegel SQL for dummies Head First SQL SQL,PL/SQL The Programming Language of Oracle by Ivan Bayross(Available in Library) You need not a buy a single book(only Bikalp is the lab classes or internet) Copyright@2012 Trident Academy of Technology 5
  • 6. Oracle has grouped the commands of SQL into the following five sublanguages. DDL(Data Definition Language): Create,Alter,Drop,Rename,Truncate DML(Data Manipulation Language) Insert,Update,Delete DQL(Data Query Language) Select DCL(Data Control Language) Grant,Revoke TCL(Transcation Control Language) Rollback,Savepoint Copyright@2012 Trident Academy of Technology 6
  • 7. Relation and Tables In relational database systems (DBS) data are represented using tables (relations). A query issued against the DBS also results in a table. A table has the following structure: Copyright@2012 Trident Academy of Technology 7
  • 8. A table is uniquely identied by its name and consists of rows that contain the stored information, each row containing exactly one tuple (or record). A table can have one or more columns. A column is made up of a column name and a data type, and it describes an attribute of the tuples. The structure of a table, also called relation schema, thus is dened by its attributes. The type of information to be stored in a table is defined by the data types of the attributes at table creation time. Copyright@2012 Trident Academy of Technology 8
  • 9. Oracle Data Types char(n): Fixed-length character data (string), n characters long. The maximum size for n is 255 bytes (2000 in Oracle8). Note that a string of type char is always padded on right with blanks to full length of n. Example: char(40) varchar2(n): Variable-length character string. The maximum size for n is 2000 (4000 in Oracle8). Only the bytes used for a string require storage. Example: varchar2(80) number(o, d): Numeric data type for integers and reals. o = overall number of digits, d = number of digits to the right of the decimal point. Maximum values: o =38, d= -84 to +127. Examples: number(8), number(5,2) Note that, e.g., number(5,2) cannot contain anything larger than 999.99 without resulting in an error. Data types derived from number are int[eger], dec[imal], smallint and real. date: Date data type for storing date and time.The default format for a date is: DD-MMM-YY. Examples: Trident Academy of Technology Copyright@2012 '13-OCT-94', '07-JAN-98' 9
  • 10. Create Command Create Command Syntax: CREATE TABLE table-name { Column-name-1 data-type-1 [constraint], Column-name-1 data-type-2 [constraint], Column-name-1 data-type-3 [constraint] }; eg-> CREATE TABLE student(regd_no number(10),student_name varchar2(30),cgpa decimal(5,3),branch varchar2(10),mob_no number(10)); Copyright@2012 Trident Academy of Technology 10
  • 11. Describe Command will Display the column names and corressponding data types present in the table. describe table-name; Desc table-name; eg: desc student Copyright@2012 Trident Academy of Technology 11
  • 12. Insert Command It can be executed in the following three ways  Insert into table-name values(value1,value2,....,valuen);  Insert into table-name (col1,col2,...,coln) values (value1,value2,...,valuen);  Insert into table-name values(&col1,&col2,...,&coln); Copyright@2012 Trident Academy of Technology 12
  • 13. View the content of table SELECT STATEMENT Syntax: SELECT col1,col2,col3,...,coln FROM table-1,...,table-n [WHERE condition] [ORDER BY col1 [ASC|DESC] [, col2 [ASC| DESC] ...]]; Copyright@2012 Trident Academy of Technology 13
  • 14. SELECT CONTINUED... The SELECT Clause lists the columns to display. The FROM clause lists the tables from which to obtain the data The WHERE clause specifies the condition or conditions that need to be satisfied by the rows of the tables indicated in the FROM clause The ORDER BY clause indicates the criterion or criteria used to sort rows that satisfy WHERE clause Copyright@2012 Trident Academy of Technology 14
  • 15. Where Clause The Conditions are of the following form Column-name comparisonoperator single-value Comparison Operators Description = Equal to <> Not equal to < Less than <= Less than or equal to > Greater than >= Greater than or equal to Copyright@2012 Trident Academy of Technology 15
  • 16. ALTER COMMAND  One can add a new column,drop an existing column,modify the datatype of a column,and drop the constraints using the following commands respectively.  ALTER TABLE table_name ADD COLUMN_name datatype;  ALTER TABLE table_name DROP COLUMN column_name;  ALTER TABLE table_name MODIFY (column_name,datatype);  ALTER TABLE table_name DROP CONSTRAINT constraint_name; Copyright@2012 Trident Academy of Technology 16
  • 17. TRUNCATE COMMAND  TRUNCATE will remove all the rows of a table TRUNCATE TABLE table-name; Note:  We can't truncate the rows of a table if there are referential integrity constraints for which this table is parent table.  We can't roolback a TRUNCATE statement Copyright@2012 Trident Academy of Technology 17
  • 18. DROP COMMAND DROP command will permanently delete the table with all its data DROP TABLE table-name [CASCADE CONSTRAINT]; Copyright@2012 Trident Academy of Technology 18
  • 19. Lab Assignment-1 Create the follwing tables  branch(branch_name,branch_city,assets)  customer(customer_name,customer_street,customer _city)  loan(loan_number,branch_name,amount)  borrower(customer_name,loan_number)  account(account_number,branch_name,balance)  depositor(customer_name,account_number) Copyright@2012 Trident Academy of Technology 19
  • 20. Assignment Continued..  Populate the branch table with the following data branch_name branch_city assets Brighton Brooklyn 7100000 Downtown Brooklyn 9000000 Mianus Horseneck 400000 North Town Rye 3700000 Perryridge Horseneck 1700000 Pownal Bennington 300000 Redwood Palo Alto 2100000 Round Hill Horseneck 8000000 Copyright@2012 Trident Academy of Technology 20
  • 21. Assignment Continued..  Populate the customer table with the following data Customer_name Customer_street Customer_city Adams Spring Pittsfield Brooks Senator Brooklyn Curry North Rye Glenn Sand Hill Woodside Green Walnut Stamford Hayes Main Harrison Johnson Alma Palo Alto Jones Main Harrison Lindsay Park Pittsfield Smith North Rye Turner Putnam Stamford Williams Nassau Princeton Copyright@2012 Trident Academy of Technology 21
  • 22. Assignment Continued..  Populate the loan table with the following data loan_number branch_name amount L-11 Round Hill 900 L-14 Downtown 1500 L-15 Perryridge 1500 L-16 Perryridge 1300 L-17 Downtown 1000 L-23 Redwood 2000 L-93 Mianus 500 Copyright@2012 Trident Academy of Technology 22
  • 23. Assignment Continued...  Populate the borrower realtion the following data Customer_name loan_number Adams L-16 Curry L-93 Hayes L-15 Jackson L-14 Jones L-17 Smith L-11 Smith L-23 Williams L-17 Copyright@2012 Trident Academy of Technology 23
  • 24. Assignment Continued...  Populate account relation with the following data account_number branch_name balance A-101 Downtown 500 A-215 Mianus 700 A-102 Perryridge 400 A-305 Round Hill 350 A-201 Brighton 900 A-222 Redwood 700 A-217 Brighton 750 Copyright@2012 Trident Academy of Technology 24
  • 25. Assignment Continued...  Populate the depositor relation with the following data Customer_name account_number Hayes A-102 Johnson A-101 Johnson A-201 Jones A-217 Lindsay A-222 Smith A-215 Turner A-305 Copyright@2012 Trident Academy of Technology 25
  • 26. Create One more table Create a student table with the following data Regdno Student_name Branch 1001 Surya CSE 1002 Binaya ETC 1003 Arup CSE Add the CGPA Column, to the student table (the type must be a floating point type) Drop CGPA column Modify the existing type of regdno. Rename student to student_trident Now delete all the data present in the student_trident table. Drop the table Copyright@2012 Trident Academy of Technology 26
  • 27. Thank You Copyright@2012 Trident Academy of Technology 27