SlideShare uma empresa Scribd logo
1 de 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.

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque

Марина Цветаева
Марина ЦветаеваМарина Цветаева
Марина Цветаева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
 

Destaque (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)
 

Semelhante a 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
 

Semelhante a 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
 

Último

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 

Último (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 

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.