SlideShare a Scribd company logo
---Dipesh Tare & Gajanan Sontakke---
---Extra Assignment---

1)
     create table Salespeople
A)
     insert into Salespeople values()
2)
     create table Customers
A)
     insert into Customers values()
3)
     create table orders
A)
     insert into Orders values()

Queries:----

1)
     Q-2) List all customers with a rating of 100.
     ans1) select * from Customers where Ratings=100;
     ans2) select cname from Customers where Ratings=100;
2)
    Q-3) Find all records in the Customer table with NULL values in the city
column.
    ans) select * from Customers where CITY=NULL;
3)
    Q-5) Arrange the Orders table by descending customer number.
    ans) select CNUM from Orders order by CNUM desc;
4)
    alter table customers add constraint pk1 primary key(cnum);
5)
     alter table customers add constraint fk1 foreign key(snum) references
salespeople;
6)
    alter table orders add constraint fk2 foreign key(cnum) references
customers(cnum);
7)
     alter table orders add constraint fk3 foreign key(snum) references
salespeople(snum);
8)
    Q-4) Find the largest order taken by each salesperson on each date.
     ans) select max(amt),odate from orders group by odate;
9)
    Q-5) Arrange the Orders table by descending customer number.
    ans) select cnum from orders order by cnum desc;
10)
    Q-6) Find which salespeople currently have orders in the Orders table.
    ans) select SNUM from orders where odate='10-JUN-96';
11)
    Q-7) List names of all customers matched with the salespeople serving them.
    ans) select cname from customers where 's.sname'='c.cname';
12)
    Q-8) Find the names and numbers of all salespeople who had more than one
customer.
    ans) select count(snum),snum from orders group by snum;

       COUNT(SNUM)        SNUM
       ------- ----------
             2       1003
             3       1001
             2       1002
             2       1007
             1       1004
13) Q-10) List the Customer table if and only if one or more of the customers in
the Customer table are located in San Jose.
   ans) select * from customers where city='San Jose';

  CNUM CNAME           CITY               RATINGS        SNUM
------ --------------- --------------- ---------- ----------
  2003 Liu             San Jose               200        1002
  2008 Cisneros        San Jose               300        1007
14) Q-15) List all the orders of salesperson Motika from the Orders table.
    ans) select count(onum) from orders where snum=1004;

      COUNT(ONUM)
      -------
                1
15) Q-16) Find all customers with orders on October 3.
    ans) select cnum from orders where odate='3/oct/1996';

         no rows selected
16) Q-17) Give the sums of the amounts from the Orders table, grouped by date,
eliminating all those dates where the SUM was not at least 2000.00 above the MAX
amount.
    ans) select SUM(amt),odate from orders group by odate having
SUM(amt)>max(amt)+2000.00 ;

  SUM(AMT) ODATE
---------- ---------
   8944.59 10-MAR-96
16) Q-18)

More Related Content

Similar to Extra assign

Create
CreateCreate
Sub Queries in oracle
Sub Queries in oracleSub Queries in oracle
Sub Queries in oracle
pyingkodi maran
 
A
AA
A
AA
Sql queries
Sql queriesSql queries
Sql queries
narendrababuc
 
DBMS Lab
DBMS LabDBMS Lab
DBMS Lab
Neil Mathew
 
Advanced row pattern matching
Advanced row pattern matchingAdvanced row pattern matching
Advanced row pattern matching
Stew Ashton
 
Sql osnova
Sql   osnovaSql   osnova
Sql osnova
Dejan Stancic
 

Similar to Extra assign (8)

Create
CreateCreate
Create
 
Sub Queries in oracle
Sub Queries in oracleSub Queries in oracle
Sub Queries in oracle
 
A
AA
A
 
A
AA
A
 
Sql queries
Sql queriesSql queries
Sql queries
 
DBMS Lab
DBMS LabDBMS Lab
DBMS Lab
 
Advanced row pattern matching
Advanced row pattern matchingAdvanced row pattern matching
Advanced row pattern matching
 
Sql osnova
Sql   osnovaSql   osnova
Sql osnova
 

Recently uploaded

Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
spdendr
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 

Recently uploaded (20)

Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 

Extra assign

  • 1. ---Dipesh Tare & Gajanan Sontakke--- ---Extra Assignment--- 1) create table Salespeople A) insert into Salespeople values() 2) create table Customers A) insert into Customers values() 3) create table orders A) insert into Orders values() Queries:---- 1) Q-2) List all customers with a rating of 100. ans1) select * from Customers where Ratings=100; ans2) select cname from Customers where Ratings=100; 2) Q-3) Find all records in the Customer table with NULL values in the city column. ans) select * from Customers where CITY=NULL; 3) Q-5) Arrange the Orders table by descending customer number. ans) select CNUM from Orders order by CNUM desc; 4) alter table customers add constraint pk1 primary key(cnum); 5) alter table customers add constraint fk1 foreign key(snum) references salespeople; 6) alter table orders add constraint fk2 foreign key(cnum) references customers(cnum); 7) alter table orders add constraint fk3 foreign key(snum) references salespeople(snum); 8) Q-4) Find the largest order taken by each salesperson on each date. ans) select max(amt),odate from orders group by odate; 9) Q-5) Arrange the Orders table by descending customer number. ans) select cnum from orders order by cnum desc; 10) Q-6) Find which salespeople currently have orders in the Orders table. ans) select SNUM from orders where odate='10-JUN-96'; 11) Q-7) List names of all customers matched with the salespeople serving them. ans) select cname from customers where 's.sname'='c.cname'; 12) Q-8) Find the names and numbers of all salespeople who had more than one customer. ans) select count(snum),snum from orders group by snum; COUNT(SNUM) SNUM ------- ---------- 2 1003 3 1001 2 1002 2 1007 1 1004
  • 2. 13) Q-10) List the Customer table if and only if one or more of the customers in the Customer table are located in San Jose. ans) select * from customers where city='San Jose'; CNUM CNAME CITY RATINGS SNUM ------ --------------- --------------- ---------- ---------- 2003 Liu San Jose 200 1002 2008 Cisneros San Jose 300 1007 14) Q-15) List all the orders of salesperson Motika from the Orders table. ans) select count(onum) from orders where snum=1004; COUNT(ONUM) ------- 1 15) Q-16) Find all customers with orders on October 3. ans) select cnum from orders where odate='3/oct/1996'; no rows selected 16) Q-17) Give the sums of the amounts from the Orders table, grouped by date, eliminating all those dates where the SUM was not at least 2000.00 above the MAX amount. ans) select SUM(amt),odate from orders group by odate having SUM(amt)>max(amt)+2000.00 ; SUM(AMT) ODATE ---------- --------- 8944.59 10-MAR-96 16) Q-18)