Recent questions tagged database-sql

0 0 votes
1 1 answer
32
32 views
Relevant relations are:$\mathrm{BUILDING(BID,\ BName,\ Address)}$$\mathrm{IN\_BUILDING(EID,\ BID)}$Which of the following queries correctly find the names of buildings wh...
0 0 votes
1 1 answer
18
18 views
Consider relations:$\mathrm{Product}$$\mathrm{Inventory}$where the underlined attributes in the original examination are primary keys.The following query returns product ...
0 0 votes
1 1 answer
14
14 views
Consider,SELECT DISTINCT TBL1.COL1 FROM TBL1 WHERE COL1 IN (SELECT COL1 FROM TBL2);Which SQL statement produces the same result?SELECT DISTINCT TBL1.COL1 FROM TBL1 UNION ...
1 1 vote
2 2 answers
25
25 views
Consider the relation $R(a,b)$. The relation may contain duplicate tuples.Which of the following queries are guaranteed not to contain duplicate tuples, regardless of the...
0 0 votes
1 1 answer
89
89 views
Three relations with the same schema are maintained for three regions:$\mathrm{TokyoProduct}$, $\mathrm{NagoyaProduct}$, and $\mathrm{OsakaProduct}$$\mathrm{ProductNo}$ i...
0 0 votes
1 1 answer
85
85 views
The database contains relations $\mathrm{animals}$ and $\mathrm{visits}$, with $\mathrm{aid}$ identifying an animal.Which SQL query returns the names of animals that visi...
0 0 votes
1 1 answer
65
65 views
Conceptually, in which order does SQL process the following three operations?$\mathrm{WHERE}\rightarrow\mathrm{HAVING}\rightarrow\mathrm{GROUP\ BY}$ $\mathrm{WHERE}\right...
0 0 votes
1 1 answer
72
72 views
The $\mathrm{Employee}$ relation contains:$$\begin{array}{|c|c|c|c|} \hline \mathrm{EmployeeNo} & \mathrm{Name} & \mathrm{DateOfBirth} & \mathrm{Department} \\ \hline 000...
0 0 votes
1 1 answer
72
72 views
The relation is:$\mathrm{Midterm}(\mathrm{ClassName},\mathrm{SubjectName},\mathrm{StudentNo},\mathrm{Name},\mathrm{Score})$.The objective is to calculate the average scor...
0 0 votes
1 1 answer
88
88 views
The relation $\mathrm{ExamResult}$ stores examination records for the previous three years:$\mathrm{ExamResult}(\mathrm{StudentNo},\mathrm{ExamDate},\mathrm{Score},\mathr...
2 2 votes
1 1 answer
189
189 views
Relation $\mathrm{R}(\mathrm{at1},\mathrm{at2},\mathrm{at3})$ contains: $$\begin{array}{|c|c|c|} \hline \mathrm{at1} & \mathrm{at2} & \mathrm{at3} \\ \hline 12 & 15 & 510...
0 0 votes
1 1 answer
103
103 views
A concert-ticket system contains $\mathrm{Sales}$ and $\mathrm{Payment}$.Relevant rules are:a row is placed in $\mathrm{Sales}$ when a purchase application is made; if pa...
2 2 votes
1 1 answer
100
100 views
Consider the relation: $$\begin{array}{c}\mathbf{EmployeeQualification} \\[4pt]\begin{array}{|c|c|}\hline\mathrm{EmployeeCode} & \mathrm{Qualification} \\\hline\mathrm{S0...
1 1 vote
1 1 answer
100
100 views
Consider the following tables.The following SQL query is executed:SELECT AVG(TotalSales) AS AverageSales FROM Product LEFT OUTER JOIN ProductSales ON Product.ProductCode ...
1 1 vote
1 1 answer
99
99 views
Consider,$\mathrm{Users}(\mathrm{userid},\mathrm{name},\mathrm{age})$$\mathrm{Dogs}(\mathrm{dogid},\mathrm{owner},\mathrm{name},\mathrm{breed},\mathrm{age})$$\mathrm{dogi...
0 0 votes
1 1 answer
95
95 views
The database contains:$\mathrm{Users}(\mathrm{uid},\mathrm{name},\mathrm{dob},\mathrm{user\_type})$$\mathrm{Posts}(\mathrm{pid},\mathrm{folder},\mathrm{summary})$$\mathrm...
3 3 votes
1 1 answer
104
104 views
The Adjacency List table stores the data for the tree structure shown below. Which SQL keyword should be inserted at $\mathbf{[a]}$ to retrieve the leaf nodes of the tree...
1 1 vote
1 1 answer
75
75 views
Consider:SQL Statement $\mathbf{1}$$\mathrm{SELECT\ *}$ $\mathrm{FROM\ R}$ $\mathrm{UNION}$ $\mathrm{SELECT\ *}$ $\mathrm{FROM\ R}$;SQL Statement $\mathbf{2}$$\mathrm{SEL...
1 1 vote
1 1 answer
90
90 views
Consider the following $\mathrm{Product}$ table:$$\begin{array}{|c|c|c|c|} \hline \mathrm{ProductID} & \mathrm{Product} & \mathrm{SupplierID} & \mathrm{UnitPrice} \\ \hli...
2 2 votes
1 1 answer
197
197 views
Given:$\mathrm{Homes}(\mathrm{home\_id},\mathrm{city},\mathrm{bedrooms},\mathrm{bathrooms},\mathrm{area})$$\mathrm{Transactions}(\mathrm{home\_id},\mathrm{buyer\_id},\mat...
0 0 votes
1 1 answer
123
123 views
Given the relation: $$\begin{array}{|c|c|c|c|} \hline \mathrm{Sname} & \mathrm{Sid} & \mathrm{Region} & \mathrm{Quota} \\ \hline \mathrm{Frances} & 25 & \mathrm{TX} & 100...
0 0 votes
1 1 answer
123
123 views
An auditing company was hired to analyze the database of the SUS (Unified Health System). Its first task is to identify pairs of registered doctors who have the same name...
0 0 votes
1 1 answer
101
101 views
Two tables are given below : $$\begin{array}{c@{\qquad}c}\mathrm{\mathbf{Orders}} & \mathrm{\mathbf{Products}} \\[4pt]\begin{array}{|c|c|c|}\hline\mathrm{Date} & \mathrm{...
0 0 votes
1 1 answer
115
115 views
A table $\mathrm{Scores}$ stores each student's marks in Japanese and Mathematics.Let,$A$ mean the student's Japanese score is at least the Japanese average.$B$ mean the ...
0 0 votes
0 0 answers
331
331 views
I am not getting the 4 query can anyone explain it
To see more, click for the full list of questions or popular tags.