0% found this document useful (0 votes)
32 views7 pages

DBMS Practice Test-2

Uploaded by

iritikdev
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)
32 views7 pages

DBMS Practice Test-2

Uploaded by

iritikdev
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/ 7
Consider the tvo funtionl dependeney st F and G, such that [A= BB C.C— AjandG= [A BCA AC. AB— C.BC— A} Which ofthe following iste? Here accontng to FD set F: A= {ABC}, B"= {ABC} and €°~ {ABC} While according ro FD se of G AT (ABC). B= {B.C So, FeoversG but G doesn't cover F Hence, option A is comet, taney th me llonncghen bow Employee [Deparment | F_Allowance Ram ‘Mechanical [5000 Sta Electrical 2000 Rea Computer 3000) Sind civil 1500 Wate coal Delong ae SELECT COUNT(*) ffom(SELECT Employee, Department fom Allowance) a5 S ‘NATURAL JOIN(SELECT Department, F_Allowance fiom Allowance) as 7}: an oe wl bpd ter apiyng NATURAL ON. Terre sownby COUNT acon wrest oe: ed Inthe sventabie meneame ohare 3 avery writen ‘hen ioe "port one an nacre ca it rescind Un Rodent once name sng mer ting stig ge tg lane! tng, ects tg ene) ftrotenon: ge crane Fretyimeger naman. Sette) ‘Thecatptethe along ey SELECT DISTINCT S sanme FROM Student S WHERE S satan IN (SELECT san FROM Favolled Fi, Faolled E2, Class C1, Cass C2 WHERE E1 snum=E2 saum AND El.euame > E2.ename AND El.ename= Cl.name AND E2.caamne= C2.nane AND CClumest t =C2 mest at) © tweens tates uns accede ce Mate ese me Comet opon ‘he qryrtrste mes ofalthe stent cadres that met athena te Let Students relation nraled Tone —[mecsot a a0 @ 300 que. Se. ame ei For the following elation sehen cmloveelemlovee-nan,sret. ctv) ‘wotks(emplojee-name, company-aaine salary) ‘compauy(company-nae ity) smanageslemployee-ame, manager-ame) Then the output of the following query select employee-name from works t where salay >(seletavaisalay) from works ‘where company-name = seompany-ame) Nota: Assume tha all people work for at most one compan: © Hier stallemsoe wher sthnthemenesy et ae hemp heme the employee hot het sry the cmpany © _Testtersmesctatempioes whe con nortan erent tempest compan. ‘one opion ‘ues ames englyes osama reese fallenplest the cna Let Work Relation: fam 1 25000 fies 1 oan ari = aca Mahesk Infos 23000 ‘Sharh cS 5000 ‘Company Relation: es hyderabad select employee-name from works t where salary “(eet avg(calary) from works 5 where ‘teompany-name ~scompany-namie) toner query returns eSB) 2000 2000 a8 tent es Consider the fllowing elatonal schema Supplieraidntezer,soamesting,ciystrng, street ring) Parsipidinteges. poame string, coloring) (Ctalogsidintessh pidinteper, costreal) Consider the following SQL query: SELECT S.aame FROM Supplier WHERE Sid NOTIN ( SELECT Cs FROM Catalog C WHERE C pid NOT IN ( SELECT Pp WHERE Peolor <> “Blue” )) ‘Assume thot relations comesponding to above schema are not empty. Which of the following isthe correct interpretation ofthe above query? res erates ue nae sapped ann shpat © Hehe roe asm vse non Beans ‘Consider the slation be: Supplier + sia | name 3 we sia | pia 21 | Green 2 | Ble First twill execute inner query s, in elation Pass: Selact Pid fom pasts P where Peolor is not equal to Blve “Than in telaton Catalog: Select Csi fom catalog C where C pid NOT IN (20,21) At asin elation Suppliers: Selet S.name from suppliers S where S sid NOT IN (3) Hence, we will get“Abe" and Def" isthe output (As we can 260, Supplier “nya” supplies both Gres aad Blue color pans, But the query say thar selet only those suppliers who only sells aon-Blve pants, which are “Abo” and Del ee SELECT student i, stodent_name FROM studeat WHERE birt_year “= ALL(SELECT birh_yea fom student) yt sane ty ave gery? © “testo ad ans as ee © Pretest andnaneso ead sts oe comet opion un tetove ry i rh na ur where wc th yaa tents nga he Lars boreatn kc onmethefotloingtfetors tte mh eat stdentscrng mat n thc et Rollo | Marks 101 » 102 38 103 9 101 n 102 66 103 56 101 a 102 86 103 36 ‘What would the below query rerun SELECT Roll No, MAX(Marke) AS Hiahest masks FROM stent sans WHERE auaks-(SELECT MAX(Macks) FROM student marks} © tet tata tt pat ca © wettest srt ements Comet option -sthe ney rr tips scrim te ver qey nts dealt anak othe ie or desman once these sen)uhehine nore thothtotheep aera sini mong aero ea osm ts a nasrt coda med “he090Psatemet emote ober the sabre lone hora pce tate ones BRP De nd TUNGHTE ae aprtoft ss einton Larges hey mn oe retarted ‘Thenerednwecmet nani he BRO stent bere DOL ontop ere le (es Findheeqaent ean gsr xeon forthe ren Le Fron racic @ 17a F€ Faculty (3C € Class (Fid ~ C Instructor id AND C.year= 2020 AND ‘oret option | ‘Tanme ~Faame AND Terseode = C.rscode))) © 1 aFe Facaky (HC € Class (Fid~ Castner id AND Cyear= 2020 AND TTaane = Fannie AND Terseode~ Ceroode) © 1 vr Facey aC € Clas (Fid= Cusco jd AND Cyetr= 2020 AND ‘Taare = Fanme AND Terseode=C.rcode)} ‘query bite ntomat asus rage aupdiceannc andthe dawson nrc ger ‘verona gsc em rego hing oer. oat ‘Thentow many auesorcneiedtaberpiucd uring sein ore Ce Basie SQL clause Selet [stint] al.92.a3..an from rl... ver condition } [group byatibutes] [having condition order by (tributes) [dese] Execution onder From where = group by > having ~ seeet > distinct => oder by Cases hic ue rplaced in exsouion order ac: elect ad distinc from starting to st soansweris2. Like Amma ehahts” ESCAPE? © Altssngs oeeianing with Aran sat™ © Avesingsbesianng with “Arabia” “Arnab ®ichah®s' ESCAPE", matches all the stings beginning with “ArzabYchah™ © Allowing beginning with “Arma sha” os, sob Consider the fllowing eatons ACTOR (id fase, lname, gender) MOVIE (i nme, year, rk) DIRECTOR (i, fname name) CAST (pid, mid, ole) MOVIE_DIRECTOR (i, mid) id column in ACTOR, MOVIE & DIRECTOR tables ea ey forthe respective table (CAST refers to ACTOR id, CAST mid refers to MOVI -MOVIE_DIRECTOR i sefers to DIRECTOR id and MOVIE_DIRECTOR mi refs to MOVIEId ‘Thea the ouput ofthe ouput ofthe following SQL Query i select distint ad, afaame loam fou Directors , Movie_Directorsb, Movie ¢ Where aid = b did and ‘bald = ed and Me year%64 = 0and c year % 100 0) or ‘over 4000) © thant cee ded tata yr © eta tte eee inte a Comet open ‘Theory lets th dames ofthe ests cts thea ee Ferhat i pects iho eect? © eterna Taam ber ftp 20 mh oN FAEE reer starminnnon reanimation rina ues arenrn ad inn unter tein ont opon ‘eget en te aro ating ens at as, wl yee Carson prod) ane inna amber mw rsa ‘amon teens and ey consransaretaen io conse © erento tees ‘Tennant ecient nine wt © chr tesmenmintcdmrnd teenie readme aa Fethteetesemenmberocsume sede corespnin alums terme andthe sane oma nied eh °e thermionic ° ‘cn tooth ranma thesauri, sndcoremendiglemrmurtavth en,

You might also like