Q3
Ans:- No
Because query 1 has distinct sname whereas query 2 can have same sname too.
Q4
Ans:- No
Because in first query s.sid = r.sid and r,bid !=103
whereas in the second query not exist condition is applied so s.sid != r.sid and r.bid != 103
Q5
Ans:- Yes
Both queries are the same, just different syntax is used.
P.S. - If you find my answer useful, please take a second to give it a THUMBS UP.
(4 points) Q3. Answer with yes or no. Are the following queries equivalent? Query1: SELECT Distinct...
QUESTION 32 Which statement can be used for conditional queries equal to if-then-else CASE WHERE DISTINCT DECODE 2.5 points QUESTION 33 The GROUP BY clause comes before the ORDER BY clause True False 2.5 points QUESTION 34 In the statement: SELECT Order_Item from orders o where order_id=1001; the "o" is a column alias table alias part of the column name a join operator 2.5 points QUESTION 35 Include which clause to this statement to return the null...
Transcribe the following SQL queries into an equivalent relational algebra expression. 1. SELECT s_number , AVG( grade ) FROM grades GROUP BY s_number HAVING AVG( grade ) > 5 . 5 ; 2. SELECT SUM( volume ) FROM fertilizer_applications LEFT JOIN crop_field ON fertilizer_applications . crop_field_id = crop_field . id GROUP BY field_number HAVING field_number = 3 ;
Write SQL queries to answer the following question: A. Which students are enrolled in Database and Networking? (Hint: use SectionNo for each class, so that you can determine the answer from the Registration table by itself.) I have attempted the code below, but am receiving an error under the first SELECT, showing error code 1064, (syntax error) SELECT StudentName, StudentID FROM Student WHERE StudentID =(select StudentID FROM Registration WHERE (SectionNo=2714 OR SectionNo=2715) GROUP BY StudentID HAVING COUNT (*)>1;
Q3 14 Points Consider the vector space P2(R). Let T1, T2, T3 be 3 distinct real numbers and 21, 22, az be three strictly positive real numbers. Define (p(x), q(x)) = Li_1 Qip(ri)q(ri) Q3.1 5 Points Show that this P2 (R) together with (-:-) is an inner product space. Please select file(s) Select file(s) Save Answer Q3.2 2 Points Give a counter example that (-, - ) is not an inner product when T1, 12, 13 are still distinct real...
Part II: Group-by and subqueries The following questions use the Spy and Sailors database. Write the SQL for the following queries. 1) List the sailor id and name for each sailor who has reserved two different red boats. Make sure that each sailor id/name is listed at most once. You must use group by/having. 2) List the missions and their status for each team. 3) For each country in agent, list the country and the count of agents in the...
Consider the following relational schema, representing a database of documents and a set of keywords: Doc(did, docTitle) Occurs(did, wid) Word(wid, word) Keywords(word) For each of the queries below, show an equivalent relational algebra plan: a.SELECT z.word, count(*) FROM Doc x, Occurs y, Word z WHERE x.did = y.did and y.wid = z.wid GROUP BY z.wid, z.word b.SELECT x.did, x.docTitle FROM Doc x WHERE NOT EXISTS (SELECT * FROM Occurs o, Word w, Keyword k WHERE x.did = o.did AND o.wid...
consider the following relational database that records details
of parts and suppliers. Primary keys are underlined and the Foreign
Keys are identified with (FK).
Suppliers (sid, sname, address, credit)
Parts (pid, pname, color)
Catalog (sid (FK), pid (FK), cost)
The credit attribute denotes the size of the supplier’s credit
account. The Catalog relation lists the prices charged for parts by
Suppliers.
Which of the following queries returns the snames of suppliers who supply every part? Select one or more: a....
K3 K3 School of CS & IT, RMIT Introduction to Database Systems Tutorial Sheet 2: SQL The database below is for a department store, and describes stock, staff, clients, and sales. Each question in this tutorial concerns this "store" database. SALE ITEM ITEM STAFF NUMSOLD CLIENT SDATE TYPE DESCRIP PRICE K3 Simon 6 Clark 19980311 Knife set $17.95 K11 Simon Cilla 19980121 K5 Ladle $6.95 K11 Simon Cilla 19980123 K11 Scraper $0.95 L12 Sorcha 5 Charles 19971130 L12 Rack $22.95...
Top of Form Q1 Which of the following is a valid aggregate function in SQL? Check only those that apply. Question 1 options: AVG LEAST COUNT MIN MOST SUM Q2 Which of the following aggregate functions will only operate on a numeric value expression? Check only those that apply: Question 2 options: MIN MAX AVG COUNT SUM Q3 When applying DISTINCT to the value being calculated in an aggregate function like COUNT, what is the effect? SELECT COUNT(DISTINCT StreetName) FROM...
Using Figure 2. show what would be displayed by the
following SQL queries should they be executed against
the tables having content (tuples/rows) shown in Figure 2. In each
answer to a question, do not forget to display column headings in
addition to the tuples/rows that would be shown.
1. SELECT pNo, MAXIat), (SELECT MAX(t) FROM sp WHERE pNo IN (SELECT RNR FROM p WHERE RNam晨= 'cam') )AS MAXcao FROM GROUP BY HAVING MAXIqty)> ALL (SELECT aty FROM Sp WHERE...