SlideShare a Scribd company logo
1 of 8
LAB – 4
create table item(itemcode number, itemname varchar(20), price number(10,2), primary
key(itemcode));

Table created.

SQL> desc item;

Name                                Null?            Type

----------------------------------------- -------- ----------------------------

ITEMCODE                               NOT           NULL NUMBER

ITEMNAME                                             VARCHAR2(20)

PRICE                                                NUMBER(10,2)



create table purchase(itemcode number, qty number, foreign key(itemcode) references
item(itemcode));

Table created.

SQL> desc purchase;

Name                                Null?            Type

----------------------------------------- -------- ----------------------------

ITEMCODE                                             NUMBER

QTY                                                  NUMBER



SQL> insert into item values('&itemcode','&itemname','&price');

Enter value for itemcode: 001

Enter value for itemname: tea_powder

Enter value for price: 25

old 1: insert into item values('&itemcode','&itemname','&price')
new 1: insert into item values('001','tea_powder','25')



1 row created.



SQL> /

Enter value for itemcode: 002

Enter value for itemname: coffee_powder

Enter value for price: 40

old 1: insert into item values('&itemcode','&itemname','&price')

new 1: insert into item values('002','coffee_powder','40')



1 row created.



SQL> /

Enter value for itemcode: 003

Enter value for itemname: dove_soap

Enter value for price: 49

old 1: insert into item values('&itemcode','&itemname','&price')

new 1: insert into item values('003','dove_soap','49')



1 row created.



SQL> /

Enter value for itemcode: 004

Enter value for itemname: clinicplus
Enter value for price: 10

old 1: insert into item values('&itemcode','&itemname','&price')

new 1: insert into item values('004','clinicplus','10')



1 row created.



SQL> /

Enter value for itemcode: 005

Enter value for itemname: chilly_powder

Enter value for price: 15

old 1: insert into item values('&itemcode','&itemname','&price')

new 1: insert into item values('005','chilly_powder','15')



1 row created.



SQL> /

Enter value for itemcode: 006

Enter value for itemname: fair&lovely

Enter value for price: 40

old 1: insert into item values('&itemcode','&itemname','&price')

new 1: insert into item values('006','fair&lovely','40')



1 row created.



SQL> /
Enter value for itemcode: 007

Enter value for itemname: rice

Enter value for price: 30

old 1: insert into item values('&itemcode','&itemname','&price')

new 1: insert into item values('007','rice','30')



1 row created.



SQL> select * from item;



 ITEMCODE            ITEMNAME                PRICE

---------- -------------------- ----------

      1              tea_powder                25

      2              coffee_powder             40

      3              dove_soap                 49

      4              clinicplus                10

      5              chilly_powder             15

      6              fair&lovely               40

      7              rice                      30



7 rows selected.



SQL> insert into purchase values('&itemcode','&qty');

Enter value for itemcode: 001

Enter value for qty: 0
old 1: insert into purchase values('&itemcode','&qty')

new 1: insert into purchase values('001','0')



1 row created.



SQL> /

Enter value for itemcode: 002

Enter value for qty: 2

old 1: insert into purchase values('&itemcode','&qty')

new 1: insert into purchase values('002','2')



1 row created.



SQL> /

Enter value for itemcode: 003

Enter value for qty: 1

old 1: insert into purchase values('&itemcode','&qty')

new 1: insert into purchase values('003','1')



1 row created.



SQL> /

Enter value for itemcode: 004

Enter value for qty: 5

old 1: insert into purchase values('&itemcode','&qty')
new 1: insert into purchase values('004','5')



1 row created.



SQL> /

Enter value for itemcode: 005

Enter value for qty: 0

old 1: insert into purchase values('&itemcode','&qty')

new 1: insert into purchase values('005','0')



1 row created.



SQL> /

Enter value for itemcode: 007

Enter value for qty: 1

old 1: insert into purchase values('&itemcode','&qty')

new 1: insert into purchase values('007','1')



1 row created.



SQL> /

Enter value for itemcode: 006

Enter value for qty: 2

old 1: insert into purchase values('&itemcode','&qty')

new 1: insert into purchase values('006','2')
1 row created.



SQL> select * from purchase;



 ITEMCODE               QTY

---------- ----------

      1                 0

      2                 2

      3                 1

      4                 5

      5                 0

      7                 1

      6                 2



7 rows selected.

SQL> select itemcode,itemname from item where itemcode in(select itemcode from purchase where
qty!=0);

ITEMCODE                ITEMNAME

---------- --------------------

      2                 coffee_powder

      3                 dove_soap

      4                 clinicplus

      6                 fair&lovely

      7                 rice
SQL> select itemcode,itemname from item where itemcode in(select itemcode from purchase where
qty=0);

ITEMCODE             ITEMNAME

----------------------------------------

     1                    Tea_powder
     2                    Chilly_powder



SQL>select i.tem_code,p.item_name,p.qty from item I,purchase p where i.item_code=p.item_code;

Select sum(item_code)total_items_purchased from purchase;

SQL>Commit;

Commit complete.

More Related Content

What's hot

Dealing with Legacy PHP Applications
Dealing with Legacy PHP ApplicationsDealing with Legacy PHP Applications
Dealing with Legacy PHP ApplicationsClinton Dreisbach
 
CocoaHeads Moscow. Азиз Латыпов, VIPole. «Запросы в CoreData с агрегатными фу...
CocoaHeads Moscow. Азиз Латыпов, VIPole. «Запросы в CoreData с агрегатными фу...CocoaHeads Moscow. Азиз Латыпов, VIPole. «Запросы в CoreData с агрегатными фу...
CocoaHeads Moscow. Азиз Латыпов, VIPole. «Запросы в CoreData с агрегатными фу...Mail.ru Group
 
Contagion的Ruby/Rails投影片
Contagion的Ruby/Rails投影片Contagion的Ruby/Rails投影片
Contagion的Ruby/Rails投影片cfc
 
Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#Vagif Abilov
 
The Ring programming language version 1.9 book - Part 95 of 210
The Ring programming language version 1.9 book - Part 95 of 210The Ring programming language version 1.9 book - Part 95 of 210
The Ring programming language version 1.9 book - Part 95 of 210Mahmoud Samir Fayed
 
The secret unit testing tools no one has ever told you about
The secret unit testing tools no one has ever told you aboutThe secret unit testing tools no one has ever told you about
The secret unit testing tools no one has ever told you aboutDror Helper
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql JOYITAKUNDU1
 
Asynchronous JS in Odoo
Asynchronous JS in OdooAsynchronous JS in Odoo
Asynchronous JS in OdooOdoo
 
Everything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to askEverything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to askAndrea Giuliano
 
PHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsPHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsMichelangelo van Dam
 
PHPunit and you
PHPunit and youPHPunit and you
PHPunit and youmarkstory
 
Postgres rules
Postgres rulesPostgres rules
Postgres rulesgisborne
 
Mastering Oracle ADF Bindings
Mastering Oracle ADF BindingsMastering Oracle ADF Bindings
Mastering Oracle ADF BindingsEuegene Fedorenko
 
How to Create a l10n Payroll Structure
How to Create a l10n Payroll StructureHow to Create a l10n Payroll Structure
How to Create a l10n Payroll StructureOdoo
 

What's hot (20)

Dealing with Legacy PHP Applications
Dealing with Legacy PHP ApplicationsDealing with Legacy PHP Applications
Dealing with Legacy PHP Applications
 
Specs2
Specs2Specs2
Specs2
 
CocoaHeads Moscow. Азиз Латыпов, VIPole. «Запросы в CoreData с агрегатными фу...
CocoaHeads Moscow. Азиз Латыпов, VIPole. «Запросы в CoreData с агрегатными фу...CocoaHeads Moscow. Азиз Латыпов, VIPole. «Запросы в CoreData с агрегатными фу...
CocoaHeads Moscow. Азиз Латыпов, VIPole. «Запросы в CoreData с агрегатными фу...
 
Contagion的Ruby/Rails投影片
Contagion的Ruby/Rails投影片Contagion的Ruby/Rails投影片
Contagion的Ruby/Rails投影片
 
Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#
 
The Ring programming language version 1.9 book - Part 95 of 210
The Ring programming language version 1.9 book - Part 95 of 210The Ring programming language version 1.9 book - Part 95 of 210
The Ring programming language version 1.9 book - Part 95 of 210
 
Automated Refactoring With IntelliJ IDEA
Automated Refactoring With IntelliJ IDEAAutomated Refactoring With IntelliJ IDEA
Automated Refactoring With IntelliJ IDEA
 
The secret unit testing tools no one has ever told you about
The secret unit testing tools no one has ever told you aboutThe secret unit testing tools no one has ever told you about
The secret unit testing tools no one has ever told you about
 
Bd venta.sql
Bd venta.sqlBd venta.sql
Bd venta.sql
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql
 
Hidden rocks in Oracle ADF
Hidden rocks in Oracle ADFHidden rocks in Oracle ADF
Hidden rocks in Oracle ADF
 
Asynchronous JS in Odoo
Asynchronous JS in OdooAsynchronous JS in Odoo
Asynchronous JS in Odoo
 
Leveraging Symfony2 Forms
Leveraging Symfony2 FormsLeveraging Symfony2 Forms
Leveraging Symfony2 Forms
 
Everything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to askEverything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to ask
 
PHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsPHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the tests
 
PHPunit and you
PHPunit and youPHPunit and you
PHPunit and you
 
Mpg Dec07 Gian Lorenzetto
Mpg Dec07 Gian Lorenzetto Mpg Dec07 Gian Lorenzetto
Mpg Dec07 Gian Lorenzetto
 
Postgres rules
Postgres rulesPostgres rules
Postgres rules
 
Mastering Oracle ADF Bindings
Mastering Oracle ADF BindingsMastering Oracle ADF Bindings
Mastering Oracle ADF Bindings
 
How to Create a l10n Payroll Structure
How to Create a l10n Payroll StructureHow to Create a l10n Payroll Structure
How to Create a l10n Payroll Structure
 

Viewers also liked

Марина Цветаева
Марина ЦветаеваМарина Цветаева
Марина Цветаеваhotcam20
 
досвід роботи
досвід роботи досвід роботи
досвід роботи nataljalistopad
 
Восточные лакомства
Восточные лакомстваВосточные лакомства
Восточные лакомстваhotcam20
 
The 6 biggest mistakes of golf instructors
The 6 biggest mistakes of golf instructorsThe 6 biggest mistakes of golf instructors
The 6 biggest mistakes of golf instructorsCharlie King
 
Up Close with Mayor Dave Bing
Up Close with Mayor Dave BingUp Close with Mayor Dave Bing
Up Close with Mayor Dave BingSkylineClub
 
Biologia odola
Biologia odolaBiologia odola
Biologia odolabioneskak
 
досвід роботи н. с.
досвід роботи н. с.досвід роботи н. с.
досвід роботи н. с.nataljalistopad
 
Guru panas baran (teori realiti)
Guru panas baran (teori realiti)Guru panas baran (teori realiti)
Guru panas baran (teori realiti)Merah Jambu
 
10 Steps to Product Market Fit - Japanese Translation
10 Steps to Product Market Fit - Japanese Translation10 Steps to Product Market Fit - Japanese Translation
10 Steps to Product Market Fit - Japanese TranslationMomoko Nagaoka
 

Viewers also liked (11)

Марина Цветаева
Марина ЦветаеваМарина Цветаева
Марина Цветаева
 
досвід роботи
досвід роботи досвід роботи
досвід роботи
 
Восточные лакомства
Восточные лакомстваВосточные лакомства
Восточные лакомства
 
The 6 biggest mistakes of golf instructors
The 6 biggest mistakes of golf instructorsThe 6 biggest mistakes of golf instructors
The 6 biggest mistakes of golf instructors
 
Up Close with Mayor Dave Bing
Up Close with Mayor Dave BingUp Close with Mayor Dave Bing
Up Close with Mayor Dave Bing
 
Biologia odola
Biologia odolaBiologia odola
Biologia odola
 
Cost element categories
Cost element categoriesCost element categories
Cost element categories
 
досвід роботи н. с.
досвід роботи н. с.досвід роботи н. с.
досвід роботи н. с.
 
Guru panas baran (teori realiti)
Guru panas baran (teori realiti)Guru panas baran (teori realiti)
Guru panas baran (teori realiti)
 
10 Steps to Product Market Fit - Japanese Translation
10 Steps to Product Market Fit - Japanese Translation10 Steps to Product Market Fit - Japanese Translation
10 Steps to Product Market Fit - Japanese Translation
 
Opportunity analysis (2)
Opportunity analysis (2)Opportunity analysis (2)
Opportunity analysis (2)
 

Similar to DBMS LAB

Organic Gardens SQL Database Schema By Christopher Kaczor
Organic Gardens SQL Database Schema By Christopher KaczorOrganic Gardens SQL Database Schema By Christopher Kaczor
Organic Gardens SQL Database Schema By Christopher KaczorChristopher Kaczor
 
Beyond SQL - Comparing SQL to TypeQL
Beyond SQL - Comparing SQL to TypeQLBeyond SQL - Comparing SQL to TypeQL
Beyond SQL - Comparing SQL to TypeQLVaticle
 
Optimizer in oracle 11g by wwf from ebay COC
Optimizer in oracle 11g by wwf from ebay COCOptimizer in oracle 11g by wwf from ebay COC
Optimizer in oracle 11g by wwf from ebay COCLouis liu
 
Sql seuence and sub queries
Sql seuence and sub queriesSql seuence and sub queries
Sql seuence and sub queriespooja kumari
 
OpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer DisastersOpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer DisastersConnor McDonald
 
Oracle Web Adi For upload item master
Oracle Web Adi For upload item masterOracle Web Adi For upload item master
Oracle Web Adi For upload item masterAhmed Elshayeb
 
Neo4j Makes Graphs Easy: Nicole White
Neo4j Makes Graphs Easy: Nicole WhiteNeo4j Makes Graphs Easy: Nicole White
Neo4j Makes Graphs Easy: Nicole WhiteNeo4j
 
SQL WORKSHOP::Lecture 7
SQL WORKSHOP::Lecture 7SQL WORKSHOP::Lecture 7
SQL WORKSHOP::Lecture 7Umair Amjad
 
Sql 99 and_some_techniques
Sql 99 and_some_techniquesSql 99 and_some_techniques
Sql 99 and_some_techniquesAlexey Kiselyov
 
Les07[1]Multiple-Column Subqueries
Les07[1]Multiple-Column SubqueriesLes07[1]Multiple-Column Subqueries
Les07[1]Multiple-Column Subqueriessiavosh kaviani
 
SQL Server 2008 Portfolio
SQL Server 2008 PortfolioSQL Server 2008 Portfolio
SQL Server 2008 Portfoliolilredlokita
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and OptimizationPgDay.Seoul
 
How Clean is your database? Data scrubbing for all skills sets
How Clean is your database? Data scrubbing for all skills setsHow Clean is your database? Data scrubbing for all skills sets
How Clean is your database? Data scrubbing for all skills setsChad Petrovay
 

Similar to DBMS LAB (20)

Organic Gardens SQL Database Schema By Christopher Kaczor
Organic Gardens SQL Database Schema By Christopher KaczorOrganic Gardens SQL Database Schema By Christopher Kaczor
Organic Gardens SQL Database Schema By Christopher Kaczor
 
SQL QUERY PRACTICE
SQL QUERY PRACTICE SQL QUERY PRACTICE
SQL QUERY PRACTICE
 
4sem dbms(1)
4sem dbms(1)4sem dbms(1)
4sem dbms(1)
 
Sql-Injection
Sql-InjectionSql-Injection
Sql-Injection
 
Beyond SQL - Comparing SQL to TypeQL
Beyond SQL - Comparing SQL to TypeQLBeyond SQL - Comparing SQL to TypeQL
Beyond SQL - Comparing SQL to TypeQL
 
Optimizer in oracle 11g by wwf from ebay COC
Optimizer in oracle 11g by wwf from ebay COCOptimizer in oracle 11g by wwf from ebay COC
Optimizer in oracle 11g by wwf from ebay COC
 
Sql seuence and sub queries
Sql seuence and sub queriesSql seuence and sub queries
Sql seuence and sub queries
 
OpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer DisastersOpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer Disasters
 
Oracle Web Adi For upload item master
Oracle Web Adi For upload item masterOracle Web Adi For upload item master
Oracle Web Adi For upload item master
 
Sql ejercicio 1
Sql ejercicio 1Sql ejercicio 1
Sql ejercicio 1
 
Neo4j Makes Graphs Easy: Nicole White
Neo4j Makes Graphs Easy: Nicole WhiteNeo4j Makes Graphs Easy: Nicole White
Neo4j Makes Graphs Easy: Nicole White
 
SQL WORKSHOP::Lecture 7
SQL WORKSHOP::Lecture 7SQL WORKSHOP::Lecture 7
SQL WORKSHOP::Lecture 7
 
Sql 99 and_some_techniques
Sql 99 and_some_techniquesSql 99 and_some_techniques
Sql 99 and_some_techniques
 
Les07[1]Multiple-Column Subqueries
Les07[1]Multiple-Column SubqueriesLes07[1]Multiple-Column Subqueries
Les07[1]Multiple-Column Subqueries
 
Plsql lab mannual
Plsql lab mannualPlsql lab mannual
Plsql lab mannual
 
Cassandra 2.2 & 3.0
Cassandra 2.2 & 3.0Cassandra 2.2 & 3.0
Cassandra 2.2 & 3.0
 
SQL Server 2008 Portfolio
SQL Server 2008 PortfolioSQL Server 2008 Portfolio
SQL Server 2008 Portfolio
 
DOODB_LAB.pptx
DOODB_LAB.pptxDOODB_LAB.pptx
DOODB_LAB.pptx
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
 
How Clean is your database? Data scrubbing for all skills sets
How Clean is your database? Data scrubbing for all skills setsHow Clean is your database? Data scrubbing for all skills sets
How Clean is your database? Data scrubbing for all skills sets
 

Recently uploaded

9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 

Recently uploaded (20)

9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 

DBMS LAB

  • 1. LAB – 4 create table item(itemcode number, itemname varchar(20), price number(10,2), primary key(itemcode)); Table created. SQL> desc item; Name Null? Type ----------------------------------------- -------- ---------------------------- ITEMCODE NOT NULL NUMBER ITEMNAME VARCHAR2(20) PRICE NUMBER(10,2) create table purchase(itemcode number, qty number, foreign key(itemcode) references item(itemcode)); Table created. SQL> desc purchase; Name Null? Type ----------------------------------------- -------- ---------------------------- ITEMCODE NUMBER QTY NUMBER SQL> insert into item values('&itemcode','&itemname','&price'); Enter value for itemcode: 001 Enter value for itemname: tea_powder Enter value for price: 25 old 1: insert into item values('&itemcode','&itemname','&price')
  • 2. new 1: insert into item values('001','tea_powder','25') 1 row created. SQL> / Enter value for itemcode: 002 Enter value for itemname: coffee_powder Enter value for price: 40 old 1: insert into item values('&itemcode','&itemname','&price') new 1: insert into item values('002','coffee_powder','40') 1 row created. SQL> / Enter value for itemcode: 003 Enter value for itemname: dove_soap Enter value for price: 49 old 1: insert into item values('&itemcode','&itemname','&price') new 1: insert into item values('003','dove_soap','49') 1 row created. SQL> / Enter value for itemcode: 004 Enter value for itemname: clinicplus
  • 3. Enter value for price: 10 old 1: insert into item values('&itemcode','&itemname','&price') new 1: insert into item values('004','clinicplus','10') 1 row created. SQL> / Enter value for itemcode: 005 Enter value for itemname: chilly_powder Enter value for price: 15 old 1: insert into item values('&itemcode','&itemname','&price') new 1: insert into item values('005','chilly_powder','15') 1 row created. SQL> / Enter value for itemcode: 006 Enter value for itemname: fair&lovely Enter value for price: 40 old 1: insert into item values('&itemcode','&itemname','&price') new 1: insert into item values('006','fair&lovely','40') 1 row created. SQL> /
  • 4. Enter value for itemcode: 007 Enter value for itemname: rice Enter value for price: 30 old 1: insert into item values('&itemcode','&itemname','&price') new 1: insert into item values('007','rice','30') 1 row created. SQL> select * from item; ITEMCODE ITEMNAME PRICE ---------- -------------------- ---------- 1 tea_powder 25 2 coffee_powder 40 3 dove_soap 49 4 clinicplus 10 5 chilly_powder 15 6 fair&lovely 40 7 rice 30 7 rows selected. SQL> insert into purchase values('&itemcode','&qty'); Enter value for itemcode: 001 Enter value for qty: 0
  • 5. old 1: insert into purchase values('&itemcode','&qty') new 1: insert into purchase values('001','0') 1 row created. SQL> / Enter value for itemcode: 002 Enter value for qty: 2 old 1: insert into purchase values('&itemcode','&qty') new 1: insert into purchase values('002','2') 1 row created. SQL> / Enter value for itemcode: 003 Enter value for qty: 1 old 1: insert into purchase values('&itemcode','&qty') new 1: insert into purchase values('003','1') 1 row created. SQL> / Enter value for itemcode: 004 Enter value for qty: 5 old 1: insert into purchase values('&itemcode','&qty')
  • 6. new 1: insert into purchase values('004','5') 1 row created. SQL> / Enter value for itemcode: 005 Enter value for qty: 0 old 1: insert into purchase values('&itemcode','&qty') new 1: insert into purchase values('005','0') 1 row created. SQL> / Enter value for itemcode: 007 Enter value for qty: 1 old 1: insert into purchase values('&itemcode','&qty') new 1: insert into purchase values('007','1') 1 row created. SQL> / Enter value for itemcode: 006 Enter value for qty: 2 old 1: insert into purchase values('&itemcode','&qty') new 1: insert into purchase values('006','2')
  • 7. 1 row created. SQL> select * from purchase; ITEMCODE QTY ---------- ---------- 1 0 2 2 3 1 4 5 5 0 7 1 6 2 7 rows selected. SQL> select itemcode,itemname from item where itemcode in(select itemcode from purchase where qty!=0); ITEMCODE ITEMNAME ---------- -------------------- 2 coffee_powder 3 dove_soap 4 clinicplus 6 fair&lovely 7 rice
  • 8. SQL> select itemcode,itemname from item where itemcode in(select itemcode from purchase where qty=0); ITEMCODE ITEMNAME ---------------------------------------- 1 Tea_powder 2 Chilly_powder SQL>select i.tem_code,p.item_name,p.qty from item I,purchase p where i.item_code=p.item_code; Select sum(item_code)total_items_purchased from purchase; SQL>Commit; Commit complete.