RDBMS Multiple Choice Questions with Answer


Hello friends in this article we are going to discuss about RDBMS Multiple Choice Questions with answer | RDBMS Objective Type Questions with Answers | RDBMS Quiz with answer | RDBMS Interview Questions with answers | RDBMS Online Quiz for practise

37.Choose the correct order in which the Oracle Server evaluate clauses

Ans – Where, group by, having

38.Predict the output of the below SQL query
SELECT DISTINCT CITY FROM CUSTOMER;

Ans-
Displays unique cities
Displays distinct cities

39.What is the command to fetch employee id, employee name and salary with 10% increase
from employee?
Employee(eid,ename,salary)

Ans-
Select eid, ename, (salary+salary0.1) from employee; Select eid, ename, (salary+salary10/100) from employee;

40.Two tables joined using SELF JOIN are different tables with the same columns

False

41.Choose a query that will display the names of colleges where the available seats are between
50 to 100 hint: inclusive of 50 and 100

ANS – Select college_name from college where available_seats between 50 and 100;

42.Carefully read the question and answer accordingly. A simple algorithm may have high
complexity, whereas a complex algorithm may have lower complexity in the sense of time needed
for the computations. State true or false

Ans-
True

43.Constraints ensures and __ of the data in the database

Ans-
Correctness
Reliability

44.Consider table Event(EventId, dateOfEvent) has following records
Event id DateOfEvent
_ __________E1
E2
12-JAN-2018
E3 13-JUN-2018
Identify the appropriate SQL statement to retrieve the eventid for which there is no date available

Ans-
Select eventide from event where dateOfEvent IS NULL;

45.Consider table Department(deptId, deptname) Which of the following query is used to
display the department details whose dept_name has second letter as ‘a’ and second last letter as ’e’?

Ans-
Select * from department where deptname LIKE ‘a%e

46.Consider table Product(prodId, price) Identify the appropriate SQL statement to display all the product details whose price range is 2500 and 5000 (exclusive 2500 and 5000) choose two most appropriate option

Ans-
Select * from product where price>2500 and price<5000;
Select * from product where price BETWEEN 2501 and 4999;

47.Consider the table Item( ItemCode, ItemName, Price, Category). Which is the correct sql query to display minimum price for categories ‘A’,’C’? Choose most ppropriate option

ANS – Select Category, MIN(Price) from Item where Category IN (‘A’,’C’) Group by Category;

48.What would be the output of the SQL statement given below?
SELECT TRANSLATE(‘aAB-Cb-abc’, ‘abc-‘,’123*’) from DUAL;

Ans- 1AB*C2*123


49.Consider table Account(accId, acctype, balance). Identify the appropriate SQL statement to
display account details in the ascending order of balance and in the descending order of accid if
the balance is same. Choose most appropriate one

Ans-
Select * from account order by balance, accId DESC;

50.Consider table Students (sid NUMBER (3), sname VARCHAR2 (10), scontact NUMBER (10)) is
already created in the database. It is required to change the data type of the column “scontact” to
VARCHAR2 (15). Which of the following is Correct for the above requirement?
Note: sid column is primary key
Choose most appropriate option

Ans-
To change the data type of a column, it is important to ensure that the corresponding column is
not having data for any of the record

51.Identify the correct statements with respect to constraints
(i) A table can have only one FOREIGN KEY
(ii) A column with UNIQUE constraint cannot have NULL value

ANS – Neither (i) and (ii)

52.Consider table Employee (empId, empname, jobband). Choose the correct sql statement to
retrieve all employee ids along with their job band. If job band is not assigned to an employee,
then it should display ‘NA’ as job band (note: Data type of column jobBand is VARCHAR2)

ANS – SELECT empId, NVL(jobband,’NA’) FROM Employee;

53.Consider table Item(itemId, category, unitprice). Identify the appropriate SQL statement to
display the category and count of items in each category in the ascending order of item count. It
should display the item details only if the count of item is greater than 1

ANS – SELECt category, count(itemId) FROM item GROUP BY category HAVING Count(itemId)>1 ORDER
BY COUNT(itemId);

54.Consider table Item(itemId, category, unitprice). Identify the appropriate SQL statement to
display Item id, and discount in the ascending order of discount

ANS – Select itemId, unitprice*0.1 as discount from Item order by discount;

55.Choose an DDL command which delete all rows from the table and where the deleted data cannot be rolled back (hint: Table structure should not get deleted)?

ANS – TRUNCATE

56.Consider the table Product (pid, pname, pcost) Identify the appropriate SQL statement to rename the table to ProductsInfo.

Ans-
ALTER TABLE Products RENAME TO ProductInfo;

57.in which of the following statements can sub queries used?

Ans –
SELECT statement and UPDATE statement

58.consider the table Project (ProjectId, ProjectName, ProjectType) is created without any
constraint and has the records as per attachment
ProjectId ProjectName ProjectType
P1 FIN A1
A2
P2 SALE
P1 FIN A1
Identify the ALTER statement which executes successfully on project table.

Ans-
ALTER TABLE Project ADD CONSTRAINT proj_pk PRIMARY KEY(ProjectId);

59.Consider table Player(PlayerId, PlayerName, Rating) has records as shown below.
PlayerId PlayerName Rating
P1 Sachin 5
P2 ABD 4.3
P3 Virat 4.6
P4
Watson 4.3
P5 Butler 4.6Identify the appropriate SQL statement to display the player details whose rating is equal to
Virat’s rating or Watson’s rating (note: Result can have Virat’s and Watson’s record as well)

Ans-
SELECT * FROM Player where Rating IN (SELECT Rating FROM Player WHERE PlayerName = “Virat”
or PlayerName= “Watson”);

60.Consider the tables given below
Customer (customerId, customerName)
Book (bookId, bookName)
Purchase (purchaseId, bookId, customerId)
bookId and customerId in purchase table are foreign keys referring to Book and Customer book
tables respectively. Which is the CORRECT SQL statement to retrieve name and book name for all
books purchased by customers?

Ans-
SELECT c.customerName, b.bookName FROM customer c INNER JOIN purchase p ON
c.customerId=p.customerId INNER JOIN book b ON b.bookId=p.bookId;

« Previous Next »


1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *