Infytq DBMS Solve

Sam has to debug and fix the errors.
How many errors are there?
CREATE TABLE mobilebooking(
bookingid CHAR(5) CHECK booking LIKE ‘B%’ PRIMARY KEY,
custid VARCHAR2(20) REFERENCES customer(custid),
NOT NULL(custid),
mobileid VARCHAR2 REFERENCES MOBILE(mobileid),
bookingdate DATE DEFAULT);

a)3
b)2
c)4
d)5

Answer:


Consider the table consultation given below:
Table: consultation

consultationiddepartmentdoctoridpatientidconsultationdatefees
1001PEDD901P90112-Feb-18210
1002ENTD902P90220-Jan-18110
1003GYND903P90320-Feb-18470
1004ENTD904P90111-Feb-18250
1005OPDD905P90412-Jan-18300
1006GYND906P90512-Mar-18640
1007PEDD901P90219-Feb-18270

Query:
SELECT consultationid FROM consultation ORDER BY ________;
What should be written in the blank above to get 1006 as third record?

a) department ASC, patiendid ASC
b) consiltationdate DESC, department ASC
c) department ASC, patiendid DESC
d) consultationdate DESC, department DESC

Answer:


Consider the table patient and consultation given below:

Table: patient

patientidpatientnamecity
101KevinNew York
102MikeBoston
103MariaChicago
104JennyNew York
105JackChacago

Table: consultation

consultationidpatientidfees
1101200
2102700
3103600
4101500
5105500
6104500

Query:
SELECT p.patientid, p.patientname, p.city FROM patient p
INNER JOIN consultation c ON p.patientid = c.patientid
GROUP BY p.patientid, p.patientname, p.city HAVING SUM(fees)>
(SELECT MAX(SUM(fees)) FROM patient p1 INNER JOIN consultation c1 ON
p1.patientid = c1.patientid WHERE patientname LIKE ‘%e%’ GROUP BY c1.patientid) – 200 ;

Which of the following will be the part of output when the above query is executed?

a)

PATIENTIDPATIENTNAMECITY
105JackChicago
103MariaChicago

b)

PATIENTIDPATIENTNAMECITY
101KevinNew York
104JennyNew York

Leave a Comment

Your email address will not be published. Required fields are marked *