ESP Suggested Q Ans
ESP Suggested Q Ans
Ans (2)
SELECT Count(*)
FROM temp
GROUP BY name;
To determine the result of the SQL query provided, let's break down what each
part does:
This SQL statement creates a table named temp with two columns: id of
type INT and name of type VARCHAR(100) .
id name
1 abc
2 abc
3 bcd
4 cde
SELECT Count(*)
FROM temp
GROUP BY name;
This SELECT query retrieves the count of rows ( Count(*) ) for each unique
value in the name column. The GROUP BY name clause ensures that rows are
grouped based on the name column.
4. Result Analysis:
There are two distinct names in the name column: "abc" , "bcd" , and
"cde" .
The GROUP BY name clause will group rows with the same name value
together.
5. Output:
The query will return:
Count(*)
-------
2
1
1
Count(*)
-------
2
1
1
2. Suppose (A, B) and (C,D) are two relation schemas. Let r1 and r2 be
the corresponding relation instances. B is a foreign key that refers to C
in r2. If data in r1 and r2 satisfy referential integrity constraints, which
of the following is ALWAYS TRUE?
Answer : (A)
Answer (C)
Table A
Id Name Age
----------------
12 Arun 60
15 Shreya 24
99 Rohit 11
Table B
Id Name Age
----------------
Table C
Id Phone Area
-----------------
10 2200 02
99 2100 01
SELECT A.id
FROM A
WHERE A.age > ALL (SELECT B.age
FROM B
WHERE B. name = "arun")
Answer (B)
5.
Answer (C)
Answer C
DELETE
A Data Manipulation Language (DML) command that removes specific rows
from a table based on conditions, while keeping the table structure
intact. For example, DELETE FROM Employee WHERE EmpID=15 .
DROP
TRUNCATE
A DDL command that removes all rows from a table, but preserves its
structure. TRUNCATE releases allocated storage space and cannot be
rolled back. For example, TRUNCATE TABLE Employee .
8. Draw the B-tree of order 3 and order 4 created by inserting the following
data arriving in sequence 92 24 6 7 11 8 22 4 5 16 19 20 7