0% found this document useful (0 votes)
31 views18 pages

Practical Slip 4

The document contains SQL commands for creating and managing a database related to train services and passenger information. It includes the creation of tables for trains and passengers, as well as examples of inserting data and querying the database. The SQL commands demonstrate how to handle various attributes such as train number, passenger ID, and seat assignments.

Uploaded by

mansichaware9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
31 views18 pages

Practical Slip 4

The document contains SQL commands for creating and managing a database related to train services and passenger information. It includes the creation of tables for trains and passengers, as well as examples of inserting data and querying the database. The SQL commands demonstrate how to handle various attributes such as train number, passenger ID, and seat assignments.

Uploaded by

mansichaware9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 18
Ls ol SQL> create table Traint( Sum cre on Ca err CC le depart_time varchar(5@), Caer ast re Ce Se source varchar(4@), oar OS ao Dee Camurri cen cy vumy avo Narr tC )) Dat VARCHAR? (50) CCAM aT \VARCHAR2(5@) SOURCE NZ ornUrXer) Pas NTanNTYCr)) Ceara Cae cane 2 pid int primary key, Pee Mr ner Pare) Poe tenance Peer an ree aia cual Canc) a CeCe CD eae eo rl Re VEC re toys eM ree Sea eu ic p_id int primary key, Pane reece PeoputasaC e ; Gender varchar(2@), check(gender in( "Male rea CDs PoC pe ee ne ae nr NOT NULL NUMBER(38) REIN te) /ARCHAR2(108) NUMBER (38) cota Nore) Seeger SCM Crum rer caste rte et eee CU p_id int references Passengersi(p_id), Pen eco ea eee CDs Seago (ee eee erry coe CSUR Ono Sees . Cente Ae: Seo) or Cerny depart_time arrival_time Patera comer rarras Rt C Ona amc ar me eg Fiseeba ured mos testi ts ae ee itstepcatrry te aar-aenyr i ers ‘dest_stn’) rari) Pee Evew] Een tre cer Ones eRe ur Ome ae eee erent tar erase eat) Enter value for arrival tine: 23:20:00 Enter value for source: Mumbai preeesie tar racer) baie He re er ren rea? eM eat ME aes CeO ne rae) few 1: insert into Traini values(102, 'Shatabdi Express’ , "09:00:00 errr Sree) Ponce ce Enter value for train_no: 103 Papen tr cenSeTEN TSS Ct aga Prensa rks trea peer errs t rasa Enter value for source: Pune Parnes reper essen eR rt ecm Sate ee eR eas Eoomerear tr into Traind values(103, Integrity Pee ere re ae) eee EE err cper Tn ee) Pad TL te Sole ira SQL> select * from Train1; ALO mm Mm U TRAIN_NO TRAIN NAME Pay me PVC oa NMS rT LT e AL VOM CLO mG 29:00:00 PER) oe fs Kola ry SOURCE Da Drea BUUCeer) ALOR Om S DU mst CUA eal SOURCE Pan BCR Ur comic ey COSeC HC) 21:00:00 LOR LCC m PCat POLAT crs RGEC eta) creer cued etree oan CL Te DRC eee Sac ae cre Curry ory old 1 Seo cetera p i RSTn Cu ae mE NT ae a | aac ew] ae ce re value for p_id: 2 RoC costa re ROW ome ues Coc Une tarry Cane eat OC ue CMC m Cm Rr at SEE US Seco ee Cum Tee cea atl Pua} Sew] aCe cant Enter value for address: Enter value for age: 60 hu US arr Cin coe Sethe for p_nane. ace ce Cicer Easter Ferenc recess Cascais Bt) ie ear cares fiecase ae cUPC RSet cers Cems cy rire oo ae CP r) coc pa od Ce RUC Oe area eee isan cure Cree Marat Scene eed oo Sa Ne aT Sa ee oeeote eee an aE Ee Cae Lee cL Cia) rape ade cas) et care) Foes) Rae ae ora) Pa os ey Pe a cry CTL Pots) UT) Pa Eat Peary PCs P_ID P_NAME Natasa) Pay Cnty coc Umea et acu mtr 3 auc eae cates 4 aC On Peart Ceo or TCA aOR Merc Pe oan Ue ees eo Lobes cram NUMBER(38) Pip NUMBER(38) ea) ATONE) renT NUMBER(38) Pyvis3 Narn TYe) ede AA RR EN Can UCSC SUR eC ca et ener eee Cro Cece em ete CRC La Cra! Eee nee cose eee) Cc OULE Ca eae Lyre Terre Sei cena ne ac UN Cane Un eC ane oY ey PSEC se nor tU Mears tec eee i rl re mr Terria Ea cee pao Eee EoeuRoteec reese crs eet reese cre Cie Um te ar caer seers OC ERC ae ear ie nC Ct Um Cae ee Peete sete mea tim eer ons cl Te My Meyer Perse wCeet se Paes ew eC Cumer TUN eet Enter value for p_i Eo ears re aera ce cn ee: d=] Soe Gee values(&train_no,&p_id, ‘&seat_no' ,&amount, RUN Ee cum Teer ee Era SPRL versa) Ue eos Oe CET) value for p_id: 4 Ce eae value for amount: 360 SOUR Teer aCrerry eee ns Lucio ON et Re eat insert into train_passenger values(103,1 Pua Lea) CWE rs eri) Pah ce OCC kar Omer) Susu UCR Coa eT aes CoD CR cue at oe Cru Ur cos Bic U ec rote rrr a seers Ce Roun ee mr oe ery Rew 1: insert into train_passenger values(103,4,°C2°,360, Ce ae ce) pyre Terris) Put PROC eae RoC Mc Tis ‘TRAIN_NO eo a Psi ec 22 Pre eere sy Para Flore sere pty Eure 500 Pe fs Scmr rs PLP eee SQL> select p_name,seat_no,train_name Uo Coe Om Cee ee Oey See Mae Ts a ee peg ue oer ese eee 5 Passenger1.p_id-train_passenger.p_id; Da Savane) BLOC Sahyadri Express Cet va eee umn ers CaS ETT Teer} Bava acho mnr Pecan COs Ee tad Pome gi Wa ag te oo SOURCE DT LaCie ts PUL Nemat Retires PS Pant Pa SEAT_NO Sta) aL mO UT DCm EUSA Led Eola Pa) Urulikanchan Cas ‘SEAT_NO aie TS meas ULSAN eng Pan Ca SOURCE SEAT_NO Bc) VOT Drama EVGA Ves ‘SOURCE Pa) Paid PULsa7 apc ite Evol te Da Dia Umar Psa Teme Ty Cas SEAT_NO boy m Tg DEPART_TIME ARRIVAL_TINE aah ccetliee gay Tarp UOT Ahmedabad eT Pe Le 3 Evel tS Sa A) Pm Cy i © A al fal ount(Gender) as total_no_of_male from Passengeri, Traini, train_passenger BS rhe] ele La Passengeri.p_id=train_passenger.p_id and Dre PU Mee PO Mee eee DOr Ree eS

You might also like