Infytq DBMS Questions and Answers 2023: In this article, we will be discussing some important Infytq DBMS Questions and Answers which will help you guys to crack Infytq 2023 exam.
So, If you are also preparing for Infytq exam, Must prepare these questions.
Also check Infytq Detailed Exam Pattern, Click here
Question 11: Consider the table instructor given below:
Table: instructor
instructorid | name | subject | university | salary |
I201 | Alex | Java | Harvard | 70000 |
I202 | Sam | Ruby | Oxford | 75000 |
I201 | Alex | RDBMS | Harvard | 60000 |
I203 | Mitchel | Networking | Cambridge | 50000 |
I202 | Sam | RDBMS | Harvard | 40000 |
I203 | Mitchel | .NET | Oxford | 50000 |
How many number of rows will be in output after executing the below query?
Query:
SELECT instructorid, name FROM instructor WHERE salary > 40000
GROUP BY instructorid, name HAVING COUNT (DISTINCT university) > 1;
A. 1
B. 2
C. 3
D. 4
Answer: Option A
Explanation: Firstly it will select those rows whose salary is greater than 40000. i.e. 5 rows will be there.
Then, due to Group By command these 5 rows will be reduced to 3 rows as this command will group same values together on the basis of instructorId.
Now, the count of Distinct university is 3 and it is greater than 1 hence it will return 1 i.e. true and finally 1 row will be returned.
Question 12: Consider a Patient table with attributes patientid (primary key), patientname, city, dateofbirth and phone. Except patientid no columns are unique. The table has three indexes as follows:
IDX1 – patientid
IDX2 – patientname, dateofbirth
IDX3 – dateofbirth, phone
Which of the following queries will result in INDEX UNIQUE SCAN?
A. WHERE city > Mumbai’ AND dateofbirth > ’30-Mar-1995′
B. WHERE patientid = ‘P1007′ AND dateofbirth = ’30-Mar-1995’
C. WHERE patientname = ‘Sam’ AND dateofbirth = ’30-Mar-1995β
D. WHERE patientname LIKE ‘R%
Answer: Option C
Explanation: Among the options WHERE patientname = ‘Sam’ AND dateofbirth = ’30-Mar-1995β alone is equivalent to IDX2. Hence our answer is Option C.
Question 13: Which is the correct syntax for BETWEEN operator?
A. WHERE column_name BETWEEN value1 AND value2
B. WHERE column_name BETWEEN (value1, value2)
C. WHERE BETWEEN column_name value1 AND value2
D. WHERE column_name BETWEEN (value1 AND value2)
Correct Answer – Option A
Question 14: Which is the correct syntax for IN operator?
A. WHERE column_name IN value1 AND value2
B. WHERE column_name IN (value1 AND value2, AND …)
C. WHERE IN column_name value1 AND value2 AND …
D. WHERE column_name IN (value1, value2, …)
Correct Answer – Option D
Question 15: Consider the tables project and allocation given below:
Table: project
projectid | projectname |
---|---|
JobsAdda101 | NAM |
JobsAdda102 | All State Bank |
JobsAdda103 | Sunrise |
JobsAdda104 | Swiss Insure |
Table: allocation
empid | empname | projectid |
---|---|---|
E300 | Nipun | JobsAdda102 |
E301 | Rahul | JobsAdda102 |
E302 | Sehwag | JobsAdda103 |
E303 | Jackie | |
E304 | Sachin |
SELECT p.projectid,p.projectname,a.empid
FROM project p FULL JOIN allocation a
ON p.projectid=a.projectid AND a.projectid IS NOT NULL ;
How many rows will be fetched when the above query is executed?
A. 7
B. 5
C. 3
D. 6
Answer: Option C
Explanation:
The FULL OUTER JOIN command will return all matching records from both tables. In this question the resultant data will be completely dependent on the query “p.projectid=a.projectid AND a.projectid IS NOT NULL”. The column a.projectid have only 3 rows without NULL i.e. E300, E301 & E302. Hence only these 3 rows will be fetched.