Download as pdf
Download as pdf
You are on page 1of 29
— vPaper - Google Chrome ie ri “onianObececsinFne aspx cai com/Exarrv Exam : SGL_Level 1 «a1 Avser need to look at some of his deta. eager 4Q DDL ; AA 5 2.@ DML Hide i Dal AK Ee 40 TL 50 DCL for Toic[e] ges SOL ALL aL) @.2 Which of the following has been achieved by the following SQL statement? SELECT * FROM employees WHERE hire_date < TO_DATE ('01-JAN-1898", 'DD-MON-YYYY’) AND salary > Scie 1.0 Only those hired before 1999 and earning less than $3600 a month are returned \ 2.@ Compile time error 3.0 Only those hired after 1999 and earning more than $3500 a month are returned 4 Runtime error BD-Only those hired before 1999 and earning more than $3500 a month are returned & G.3 Eveluate these two SOL statements: SELECT last_name, salery , hire date FROM EMPLOYEES ORDER BY salary DESC; ast_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC: What is true about them? ‘1.@ The two statements ptodues identical vesuke 2.0 The second statenjent tehitos.@ Syntax enter 3 © There is no need to 8.4 You query SELECT name Q.3 Evaluate these two SOL statements: ‘SELECT Isst_name, salary , hire_date FROM EMPLOYEES ORDER BY sslary DESC; SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC; i ‘What is true about them? i 1.@ The two statements produce identical results, I 2.0 The second statement returns a syntax error. © There is no need to specify DESC because the results are sorted in descending order by default | WT © The two statements cat be made to produce identical results by adding a column alias for the salary column in the second SQL statement , . | 1 i 2.4 You query the database with | Sr ha SELECT name FN ie FROM employee HN i y\ WHERE name LIKE" a%'; Ny Wy Which names are eplyed? 4.© Names starting with! *a") 2.2 Names starting with "aRVor Al) 3.@ Names containing “a}.as. iseedet na Mt 4 Names containing “aR as nae piteeeie fiat || A Next \ \ ii) \\\ Heit mi | @.5 The CUSTOMERS table has these columns: CUSTOMER_ID NUMBER(4) NOT NULL CUSTOMER_NAME VARCHAR®2(100) NOT NULL STREET_ADDRESS VARCHAR2(150) CITY_ADDRESS VARCHAR2(50) Gaye STATE_ADDRESS VARCHAR2(S0) Hane PROVINCE_ADDRESS VARCHAR?(50) COUNTRY_ADDRESS VARCHAR2(50) POSTE_CODE VARCHAR?(12) CUSTOMER_PHONE VARCHAR? (20) * THE CUSTOMER_ID column is the primary key for the table which two statements find the number of customer? (Choose two.) (A)SELECT TOTAL (*) ate il FROM customers; eh (B)SELECT COUNT (*} _ FROM customers; {C\SELECT TOTAL tienen ~id) FROM customer: {D)SELECT COUNTIcosiarn FROM customer; (E\SELECT COUNT(customers) FROM customers; . (FISELECT TOTAL (customer naine} FROM customers; NN @.6 The CUSTOMERS table has these columns: CUSTOMER_ID NUMBER(4) NOT NULL CUSTOMER_NAME VARCHAR2(100) NOT NULL STREET_ADDRESS VARCHAR2(150) CITY_ADDRESS VARCHAR2(50) ‘STATE_ADDRESS VARCHAR?2(50) | PROVINCE_ADDRESS VARCHAR2{50) COUNTRY_ADDRESS VARCHAR2{50) POSTAL_CODE VARCHAR2(12) CUSTOMER. PHONE VARCHAR2(20) Which statement is used to display “for all the customers in the CUSTOM able that do not have @ postal c sétomersWHERE ive code =" GustomersWHERE postal code ($ NULL OM customersWHERE pastat code |S NVL; START_DATE DATE |) | END_DATE DATE AY ns are valid Which two aggregate ‘ne {@ quest techmahindra.com/Exam/Examination/ObjectiveQuestionPaper.aspx TORS G.8 The STUDENT_GRADES table has these columns STUDENT_ID NUMBER(12) ‘SEMESTER_END DATE GPA NUMBER (4,3) The registrer has asked students enrolled during ser accomplishes this? . 1° SELECT AVERAGE(gpa)FROM student_g semester end < ’31-DEC-2000" © SELECT COUNT (gpa)FROM student grades WHER semester end <’31-DEC-2000" © SELECT MID (gpa)FROM student_gradesWHERE semes' semester end < ’31-DEC-2000' 4 @ SELECTAVG (gpa)FROM student_grades WHERE semester_end > ‘01-JAN-2000" and semester end <’31-DEC-2000" © SELECT SUM (gpa)FROM student_arades 5. semester end <'31-DEC-2000" for @ report on the average grade point average (GPA) for mesters that end in the year 2000. Which statement radesWHERE semester_end > '01-JAN-2000’ and E semester_end > ’01-JAN-2000" and ter_end > '01-JAN-2000' and 2 WHERE semester_end > '01-JAN-2000' and @.9 The STUDENT_GRADES table has these columns STUDENT_ID NUMBER (12) SEMESTER_END DATE GPA NUMBER (4, 3) Which statement: can b point, average (GPA) great ROM student grades WHERE 5 id who have a grade 12 used to display student ter than 3.0 for the calendar year 2009 emester_end between ‘01-JAN-2008" and SELECT student_id Ff 34-DEC-2009' or gpa73.0 2009" t_grades WHERE semester_end BETWEEN '01-JAN~ SELECT student_id FROM studen 2 nd '31-DEC-2009' and gpa gt 3.0 / @ SELECT student_id FROM student grades WHERE semester_end BETWEEN ‘01 YAN-2009 JAN-2009 2 © Jaa '31-DEC-2009" and gpar3.0 : SELECT student_id FROM student grades WHERE semester_end BETWEEN 0 4 and '31-DEC-2009' and gpa<3 10 AB 20 ADE 30 DEF 4@BD 50 CDE Q.6 The CUSTOMERS table has these columns: CUSTOMER_ID NUMBER(4) NOT NULL CUSTOMER_NAME VARCHAR2(100) NOT NULL STREET_ADDRESS VARCHAR2(150) CITY_ADDRESS VARCHAR2(50) STATE_ADDRESS VARCHAR2(50) PROVINCE_ADDRESS VARCHAR2(50) COUNTRY_ADDRESS VARCHAR2{50) POSTAL_CODE VARCHAR2(12) ° CUSTOMER_PHONE VARCHAR2(20) Which statement is used to display the first 4 letters of state_address for all the customers in the CUSTOMERS table that do not have @ postal code? © SELECT substr(state_address,1, ,4)FROM customersWHERE postal_code CONTAINS NULL; 2 a SELECT substr(state_address,1 |,4)FROM customersWHERE postal_code = ' 3.0 SELECT substr(state_address,1, 4)FROM customersWHERE postal_code |$ NULL 40 SELECT substr(state_address,1,4)FROM customersWHERE postal code IS NVL; 5,© SELECT substr(state_adidress,1,4)FROM,customersWHERE postal_code = NULL; G.7 Examine the description of the STUDENTS table:-. STD_ID NUMBER(4) COURSE_ID VARCHAR2(10) START_DATE DATE END_DATE DATE FROM customers; 1OAB 20 ADE 3.0 DEF 4@ BD ARO 50 ¢6,D,E y G.6 The CUSTOMERS table has these columns; = het (CUSTOMER_ID NUMBER(4) NOT NULL at if 1 " CUSTOMER NAME VARCHAR2(100) NOTNULL 5 STREET_ADDRESS VARCHARE(150) Ctra CITY_ADDRESS VARCHAR2(50) ey STATE_ADDRESS VARCHAR2(50) ( PROVINCE_ADDRESS VARCHAR2(50) COUNTRY_ADDRESS VARCHAR®(50} POSTAL_CODE VARCHAR2(12) CUSTOMER_PHONE VARCHARA(20) Which statement is used ta display the first 4 letters of state address for all the customers in the CUSTOMERS table that do not have a postal code? \ | 1.0 SELECT substr(state_addrass) 1,4)FROM customersWHERE postal_code CONTAINS NULL: 2. SELECT substr(state/ address 1,4)FROM customersWHERE postal_code =" H 3, SELECT substr(state adidreset A)FROM customersWHERE postal_code I$ NULL, 4.0 SELECT Substr(state_adaress 4 AFROM GustomerSWHERE postal code IS NVL; 5.Q SELECT |Substr(State | laddress (4)FROM CustomersWHERE postal coda = NULL; i & | G.7 Examine the description of the STUDENTS table: STD_ID NUMBER(4) COURSE_ID VARCHAR2(10) START_DATE DATE END_DATE DATE a Ty echmah Se ae eee ed Q.7 Examine the description of the STUDENTS table: ‘STD_ID =NUMBER(4) COURSE_ID VARCHAR2(10) START_DATE DATE END_DATE DATE Which two aggregate functions are valid on the ST/ (AJSUMIstart_date) (B)AVG (start_date) (C)COUNT (start_date) (D) AVGistart_date, end_date) | f (E) MIN (start_dete) Ni (F) MAXIMUM (startdate) | anata 1048 bhai hy KN Ny 20 DEF ay Wy td ' 30BD My i ‘e Waa 4© CE = af Oh wi 5.O A.C. / Hint He WN SELECT COUNT (gpa)FROM =e saa semester end < '31-DEC-2000' 2 la ce ip i SELECT MID (gpa)FROM student oradeslaAER " iva land semester end < '31-DEC-2000! i te 2 : fen o wkext ran toparnom stator ott hein ete ‘eccomplishes this? © SELECT AVERAGE(gpaJFROM ald acl i semester end < ’31-DEC-2000° i 4 © SELECT COUNT (gpa)FROM student grades. Moai semester end < '31-DEC-2000" \ i © SELECT MID (gpa)FROM student_gradesWHERE. beat ‘semester end < '31-DEC-2000° } @ SELECTAVG (gpa)FROM student_grades Hh semester end< '31-DEC-2000° Q SELECT SUM (gpa)FROM CaM Hi rend > pend <'31-DEC-2000" |, Wi ql Mi = "i nme |) Q-SELECT studentla1 "34-DEC-2009 or gpe78. SELECT student id FROM stucar and '31-DEC-2008' end gpasai SELECT student id FROM stiides and '31-DEC-2008' and’gpa3; tan Paper - Got eae Sad 5: imigsc ragga apse arr awe RR OO PEW a a lt sitechmahindra .com/Exam/Examination/ObjectiveduestionPaper aspx | @.10 Customer and Product tables has following structure | Product } | prod_id Varchar2{20) Primary key >< prod_name Varchar2(20) | company_name Varchar2(20) | | product_launch_date Date | | Mob_no. Number{10) Primary key prod_id Varchar2{20) Foreign key, cust_name Varchar2(30) Not Null home_loc Varchar2(20) Not Null Address Varcher2(20) Not Null Which of the following query displays product name and number of customers for each product whose home location is Pune’ { ) . @ selget p PROD_NAME,count(¢.mob_no) from product p,customer cwhere P-Prod_id=¢!prod_id and c.home_loc='Pune’ group by p.PROD, NAME: ©) Select psPROD_NAME,suin(c.mob_no) from product p,customer ewhere p.prod_i yd ¢,hame_loc='Pune’ group by p:PROD_NAME; 'p.PROD_NAME, count{c.mob_no) from product p,customer cwhere 1¢,prod_id anid ¢.home_loc='Pune" ; c.prod_id ntlediataty athe tbe Botare the WHERE: Customer cwhere P-Prod_id=c prod ig | | * group by P.PROD_NAME: O select ® PROD_NAME, count(c.mob_no) from 7 P-prod_id=c.prod_id and . O select p. PROD_NAME, _NO) from Product P,customer cwhere : P. Prod_id=c.prod_id and ¢.home_loc="Pung Having P-PROD_NAME: Q.11 Ine SELECT Statement that includes a WHERE Clause, where ig the GROUP By Clause Hank | placed? ails 10 Immediately after the’s: 2.0 Before the WHERE eta) 5 ELECT clauge Lise, i 30 Before the FROM clause 40 After the ORDER By ‘lause 5.© After the WHERE Clause, Q.12 Customer and Cust_chennel tables hes following structure Customer Cust_ID Char{7) Primary Key Cust_Name Varchar2(15) Not null Credit Number{3) Cust_chennel Cust_ID Cher{7) Foreign Key and Primary Key Channel_ID Char{9) Foreign Key Date_of_Sub Date Not null . which of the following query is used to display the cust_name,channel_id for all customers who has subscribed the channel. Also display cust_names who has not subscribed any channel till date G.13 Customer and Product tables has following structure @.12 Customer and Cust_channel ti org pructine i Cust_ID Char{7) Primary Key ty i Cust_Name Varcher2(15) Not null i Gredit Number{3) ae) i Cust_channel I Cust_ID Char{7) Foreign Key and Primary Key Channel_ID Char{9) Foreign Key fi Date_of_Sub Date Not null Mi which of the following query is used to display the cust_name,channel_id for all customers. who has subscribed: the Prati! Also on cust_names who has not subscribed any channel till date ’ 1, seleét,cust.iame,channel.id trot cust channel c join customer ct on ¢.cust_fd-e1.cust.td; @ Select’cust_name, channel: id froin cu o.cust_id=cticust 4 phannel @ right outer join Customer cf on , O'Selegt cust_name, pannel | id froin east eneninel ‘oléftiouter join customer ¢1. on *-. 'c.cust_idect.ctist.id; ; Select cust name,chahine(_id ftonw cust channel e rightouter Join customer ot on censt_idsct cust id; ¢ 4 G.13 Customer and Product tables has following structure * Product: prod_id Varchar2(20) Primery Key’ “cutechmahindra.con/Exam/Examinalion/OPh 62.13 Customer end Product tables has folowing structure | Product 1, prod id Varchar2{20) Primary key uh AA t I ; prod_name Verchar2(20) WN company_name Varcher2(20) WML product_launch_date Date bi Nagy UM Customer ‘4 Mob_no Number(10) Primary key sh asiiny ewe 8A prod_id Varcher2(20) Foreign key” Weed! cust_name Varchar2(30) Not Null Lay AT home_loc Varchar2{20) Not Null Pia ‘Address Varchar2{20) Not Null Ay i , vy gee = Which of the following query displays Mob_no, product, name,company_name for all” cuore i whose home location is ‘San Frensisco’ 3 & select o.Mob_no,p product name;p.combany_fiame from product p,customenc where jreme_toc like ‘San Fransisco'and p.prod, id=c.prod_ jd ne foduct name,p.€omparly-nathe from product pycustomer c where 7 iMate et y_name! ve Wai ! ‘ "rojh product picustomer c where Si : te; it if ‘ - ‘ Pp product name.p.ct pgme fromm product pléustomer ¢ where ‘ee ‘Pune’ and p:pred.idee.prodid! = | Spies ere : S =— : Ee Ay ym A G.14 Examine the data in the EMPLOYEES and DEPARTMENTS tables. © EMPLOYEES ; i= ’ LAST_.NAME DEPARTMENTID SALARY ‘i t Gen 10 “3090 ~! - , Davis 20 4500 t W t King 20 2200 We Wirt A ’ Davis 30 5000 ie Mi by, Sy 5000 ¥ ‘home_toc like ‘Pune’ and p.prod_id=c.prod_id | | 1.0 SELECT as | 20 SELECTIast ke f “ge * = * (edepartiment ool ON (ed payment. id VARCHARD (20) payment_amt NUMBER) payment, date Date eLtechmabndra.com/Exer/Examrination/ObjectiveCuestionPaper.ssp (Cust_payments coust.id NUMBER Composite key payment. id VARCHAR2 (20) Composite key ppayment_amt NUMBER, payment_date Date \VAT_PERCENT NUMBER Percentage vet for given payment range ‘You need to find the percentage vat applicable for each customers payment. Which SQL ‘statement, ‘would you use? 1.© SELECT cust_id;payment_amt, vat_percentFROM cust_payments ¢,payment_vat pWHERE -payment_emt= p.MIN_payment AND c.payment_amt =p.MAX_payment: © SELECT cust_id, payment_amt, vat_percentFROM cust_payments c,payment_vat pWHERE -payment_emt = p.MIN_payment OR c.payment_amt=p.MAX_paymet 3 © SELECT cust_id, payment_amt, vat_percentFROM cust_payments ¢,payment_vat pWHERE ~'c,payment_amt BETWEEN p.MIN_payment AND p:MAX_payment; 4.@ SELECT cust _id, payment_amt, vatipercentFROM cllst_payménts c,payment_vat p Q.16 To write & query that performs an outer join of tables A and B and returns all rows from B only, You need to write 1.0 Full outer join 20 Alett outer join 20 Reross join 4@ Aright outer join 5.7 An inner join Section: Subqueries : ath Nir ' Q.17 Customer and Product tables has fra sere \\\ \ NaN \\ AVA AS NANOS i i} Product: \ prod_id Varchar2(20) Primary key. i prod_name Varchar2(20) company_name Varchar2(20) Corner name can be Product_launch_date Date Customer WII Mob_no Number{10) Primary ke \ | \ prod_id Varchar2{20) sree k \ \ cust_name Varchar2(30) Nt i iN Wk home_loc Varcher ato} Noe Riot ~ Hom mn cant pune, mul ask Address Verchar2(20) Not Null " i } customer type Varchar2(20) Not wih Corporate, residential, wholesale eto, | \ \ WA N contact _type ease) Not Null \ I Which of the follawing ae d we fe i date | Ws Fe Select prod_id from paket P) vihete tne ec: P-Prod_id=e.prodiqy)\/ I In WAAL \ Select prod_id from pradiie a Select prog _id from Product ~ p.prod_ide: ©.prod_id) voi hoe Sts) 4 Select prod _id fron) “ p.prod_| estteclmahindra.comy/lxam/Examinatior/ObjectiveQuestionPapera ALN fl ¥ Customer {ttt Cust, ID Char{7) Primary Key Cust_Name Varchar2{15) Not null Credit, Number{3) Cust_channel \ Cust_ID Cher{7) Foreign Key and : Channel_ID Char{9) Foreign Key Date_of_Sub Date Not null : \ iy t which ofthe folowing query is us c zy hes subscribed eny oH nel till date ‘i ‘ ; t | WAAAY : eva : E 1.0 select cust ft er 6 whe hil eta cst io channel c1 ) Se © select cust_id from Tc Whete exists (sel ' ‘leet cust id from cust:ehannel et where IiMitoNarene coos it i \ {N\\\ hy O select cust_id fror c.cust_id-et cust j O select cn from c-cust_id-ct.¢ ii } iV ag cast Ma Pred i follows ii he i i MA Customer i Li Cust_id Verchar2(5)/Primay Ny i Ny Cust_name Varchi Neen th baht Cust_add Varchar@{5Q) | ne Cust city char(15) Auli in Cust.cre limit Number(10) Cust_cre_period Data \ elect cust. from cust_channel c1 where. ust_channel 61 where stechmahindra.com/Exam/Examination/Objecti .19 Customer end Prod_order tables are as eH follows Cust_id Varchar2(5) Primary Key Cust_name Varcher2(20) Not Null i Cust_add Vercher2(50) | Cust_city char{15) Cust_ore_limit: Number{10) Cust_cre_period Date ‘ | Prod_Order Order_id Varcher®{5) Primary Key Order. dete Dete Prod_id Verchar2{5} Foreign Key Cust_id Varchar2(5) Foreign Key Order_qty Number{5) Which of the following stataments displays customer names who has ordered maximum total quantity of products till date. © select s.¢ust_name,count(order_qty) from prod_order p,customer c where © ust id’p. ust id group by cicust_name having count(order_aty)in (select : ‘mex{coht{order_aty)) trom prod_order group by cust_id) © selbete cush nanie suin|order._ qty) trom prod_order p,customer c where c cust_id=p.cust_id 2. group yt eubt_ name Having sum(order_aty)in (select min(sum(order_qty)) from prod_order group By cuét. td) Selett c-ebbt hatha euni/ retin, aty) trom 3. group by ¢.cisttl mame maving) Suinibrdet group by cust taj! fl Prosllorder p,customer c where c.cust._ id=p.cust_id, satv)in (Select max(sum(order_gty)) fro m prod_order select ¢ cust. mam gdntlnnia 4. group by e.cust haiti Hava) Group by cust iff), Tiare PredLotder p.customer c where c.cust_id= ‘ P.cust id UTTIRFART AHN (abtect sum(order_aty)) trom prod_order group by cust_id) oe Hy @ select c.cust_name,sum(order_qty) from prod_order p mer ¢. ti 3. group by c.cust_name having sum(order_aty)in {select max(sum( 8) from prod_order group by cust_id) AP Et ene i CO select c.cust_name,sum(order_aty) from prod_order p,customer ¢ where ¢.cust_id*p.cust_id | 4. group by c.cust_name havi a summ(order_qfylin (select sumjorder_aty) from prod_order | group by cust_id) Q.20 Examine the subquery: Wh ‘SELECT last_name FROM employees WHERE salary = (SELECT MAX (salary) FROM employees); Which statement is true? 1.@ The SELECT statement is syntactically accurate. . | 2. The SELECT statement does not work because there is no HAVING clause The SELECT statement does not work because the column specified in the GROUP BY clause is not In the SELECT list. ZO The SELECT statement does not work because the GROURSBY clause should be in the main query and not in the subquery. ~ @.21 What is the purpase of a sub query ? 1.© create groups of data 2.0 Sort data in a specific: 3.0 convert data to a dite sstion Paper - Guoyle Chrome sesttechmahindra. com/bxamn/bxan 1.CREATE TABLE salary 2.{employee_id NUMBER(S) { | S.CONSTRAINT salary_pk PRIMARY KEY, 4.1995 _selery NUMBER(S, 2), S.menager_name VARCHAR2[25) 6.CONSTRAINT mgr_name_nn NOT 7.$selery_96 NUMBER(8,2) NULL; aL ALTER TABLE Clistoriie 2 TABLE, istorii it diy G.24 Which ALTER ich ALTEF som | constraint? Which two lines of this statement will return errors: (nous 10 23 2034 ARE 3@ 47 4037 f 5067 , @.23 Which statement adds a constraint that ensures the CUSTOMER_NAME column of the CUSTOMERS table holds @ value? ; @ ALTER TABLE customers ADD CONSTRAINT cust_name_nn CHECK customer_name ISNOT NULL; . A i © ALTER TABLE customers MODIFY CONSTRAI 2” NOTNULL; 3,0 ALTER TABLE customers MODIFY customer_name CONSTRAI! ame CONSTRAINT cust_name_nn I$ NOT INT cust_name_nn CHECK customer_name IS | INT cust_ngme_nn NOT NULL; €O ALTER TABLE customers MODIFY customer NULL; Oe TABLE customers MODIFY name CONSTRAINT c TABLE customers ADD CONSTRAINT.cust_niame_nn CHECK customer_name NO ust_name_nn NOT NULL; FALTER TNULL;, 3.24 Which ALTER command would you use to reinstate @ disabled primary key straint? ; SALTER TABLE cars ENABLE PRIMARY KEY (id)?) 1%, SS rs ENABLE CONSTRAINT c@rsuid_ Of a LE/PRIMARY KEY Ue) CASCADES RAD rap K PRIMARY KEY sid); @ ALTER TABLE Q.25 Customer table has following structure \ : oe ‘ Customer Mya i : 5 Mob_no Number{10) Primary key HVA Aa REG: i prod_id Varchsr2{20) Foreign key ' ‘ cust_name Varchar2(30) Not Null home_loc Varchar2(20) Not Null Address Varchar2(20) Not Null Which of the following staan tance has ae Bony 1.0 delete * from customer where home_loc='Bombay'; 2,@ delete from customer where home_loc='Bombay’; 3.0 delete * customer where home_loc="Bombay’; 4. delete customer where home_loc !="Bombay'; G.26 Examine the structure of the EMPLOYEES and Nees tables: EMPLOYEES EMPLOYEEID NUMBER Primary Key FIRST_NAME — VARCHAR2(25) LAST.NAME — VARCHAR2(25) HIRE_DATE DATE NEW_EMPLOYEES ' ahae ys EMPLOYEE_ID NUMBER ~ Primary Key — NAME VARCHARE(60) Which DELETE statement is yee? 4.2 DELETE FROM employees Glee employee id= (SELECT duiptoyee id FROM tai DELETE * FROM énipléyees; WHERE inploies id PREY employee. new_employees); , @ DELETE FROM employees WHEREsdinpto esitl *- new_employees WHERE name ='Gatreyi ' 0.27 User JANKO would like to insert @ naw into the EMPLOYEE: table, which hes three EMPLOYEE_ID NUMBER — Primary Key \ FIRST.NAME — VARCHAR?2(25) LAST_NAME —VARCHAR225) HIRE.DATE — DATE 'NEW_EMPLOYEES: EMPLOYEE ID NUMBER NAME VARCHAR2(60) Which DELETE statement is valid? Primary Key 1.© DELETE FROM employees WHERE employee_id = (SELECT employee_id FROM employees) > © DELETE * FROM employees WHERE employee id = (SELECT employee_ii FROM “ new_employees); @ DELETE FROM employees WHERE employee_id IN (SELECT employee_id FROM ~- new_employees WHERE name ="Carrey' @.27 User JANKO would like to insert a row into the EMPLOYEE table, which has three columns: EMPID, LASTNAME, and SALARY. The user would like to enter date for EMPID 59694, LASTNAME Harris, but no salary. Which statement would work best? 4-S-INSERT INTO employee VALUES (89694,HARRIS’, NULL); CoINSERT INTO employee VALUES (69604,'HARRIS)); CAINSERT INTO employee (EMPID, LAS TNAME) SALARY) VALUES (59694, HARRIS’); z 4-INSERT INTO employee (SELECT| 58404 FROMPHARKIS") o i = a | = = S 8 fT rs) e = Ss 8 ® Qo 4 commit 18 MERGE 3. ROLLBACK i 0, 4 Q.29 Customer and Product tables has following structure Product, ay prod_id Varchar2(20) Primary key prod_name Varchar2(20) company_name Varchar2(20) product_launch date Date Customer Mob_no Number{10) Primary key prod_id Varchar2(20) Foreign key . cust_name Varchar2(30) Not Null ; home_loc Varchar2(20) Not Null . Address Varchar2(20) Not Null Which of the following query will create a view containing cust_name and prod_name for all customers product_leunch date is in the year 2009 » create view prod_cust_vw as select p.prod_name,c.cust_name from product p,customer c where p.prod_id=c.prod_id and to_date(p.product_launch_date)=2009 , © create view prod_cust_vw as select p.prod_name,c.cust_name from product p,customer c where p.prod_id=c.prod_id and to_char(p.product_launch_date,"yyyy’}=2009 create view prod_cust_vw as select p.prod_name,c.cust_name from product p,customer ¢ Where to_char(p.product_launch_date,'yyyy')=2009 create view prod_; ust_vw as select p.prod_name,c.cust_name from product p,customer ¢ where p.prod_id=c.prod_id Q 30 Customer and Cust_channel tables has following O create view prod_cust_vw as select p.prod_name,c.cust_name from product p,customer c where p.prod_id=c.prod_id Q.30 Customer and Cust_channel tables has following structure Customer Cust_ID Char{7) Primary Key Cust_Name Varchar2(15) Not null Credit Number(3) Cust_chennel Cust_ID Char{7) Foreign Key and Primary Kef> Channel_ID Char{S) Foreign Key Date_of_Sub Date Not null Which of the following query will create a view containing cust_name,channel_id,date_of_sub,credit_number for all customers © create view cust_yw as select c.cust_name,c1.channel_id,c1.date_of_sub,c.credit_number from customer ¢ ,cust_channel c1 ‘© create cust_vw as seléct c.cust_name,ct.channel_id,c1.date_of_sub,c.credit_numbef trom ‘Gustomer c .cust_channel c1 where c.cust_id=c1.cust_id © create view cust_vw as select c.cust_name,ct.channel_id,c1.date_of_sub,c.credit_number from-customer ¢ .cust_channel c1 where c.cust_id=c1.cust_id create View cust_vw as select c.cust_name,c.credit_number from customer ¢ ,cust.channel ct where c.cust Jd=c1.cust_id Fram Id Your % Score Your Exam Status Passing % Attempt No 7 Rating Pass 60 1 3.85 tel Introduction to SQL 1 0 0 SELECT command 3 2 67 ‘SQL Operators and Functions 5 5 100 ‘Group By Having Clause 2 2 100 Joins 5 4 80 Subqueries 5 3 60 DDL commands 3 2 67 DML Commands 3 3 100 TCL commands 1 0 0 Read Only Views 2 2 100

You might also like