Database Management Systems (3130703) MCQs

MCQs of SQL Concepts

Showing 11 to 20 out of 68 Questions
11.

Write SQL statements (Query) for following tables:

Customers (CustomerID, CustomerName, ContactNo, City, PostalCode, Country, Amount)

CHANGE CITY NAME OF PRABHU RAGI FROM SYDNEY TO DALLAS.

(a)

UPDATE CUSTOMERS SET CITY = 'DALLAS' WHOSE CUSTOMERNAME = 'PRABHU RAGI' AND CITY = 'SYDNEY'

(b)

UPDATE CUSTOMERS SET CITY = 'DALLAS' WHERE CUSTOMERNAME = 'PRABHU RAGI' AND CITY = 'SYDNEY'

(c)

UPDATE CUSTOMERS CHANGE CITY = 'DALLAS' WHOSE CUSTOMERNAME = 'PRABHU RAGI' AND CITY = 'SYDNEY'

(d)

UPDATE CUSTOMERS CHANGE CITY = 'DALLAS' WHERE CUSTOMERNAME = 'PRABHU RAGI' AND CITY = 'SYDNEY'

Answer:

Option (b)

12.

Write SQL statements (Query) for following tables:

Customers (CustomerID, CustomerName, ContactNo, City, PostalCode, Country, Amount)

GIVE 10% INCREMENT IN AMOUNT.

(a)

UPDATE CUSTOMERS SET AMOUNT = AMOUNT + (AMOUNT * 0.1)

(b)

UPDATE CUSTOMERS CHANGE AMOUNT = AMOUNT + (AMOUNT * 0.1)

(c)

UPDATE CUSTOMERS UPDATE AMOUNT = AMOUNT + (AMOUNT * 0.1)

(d)

UPDATE CUSTOMERS SET AMOUNT = (AMOUNT * 0.1)

Answer:

Option (a)

13.

Write SQL statements (Query) for following tables:

Customers (CustomerID, CustomerName, ContactNo, City, PostalCode, Country, Amount)

UPDATE AMOUNT OF ALL CUSTOMERS FROM 3000 TO 5000.

(a)

UPDATE CUSTOMERS UPDATE AMOUNT = 5000 WHOSE AMOUNT = 3000

(b)

UPDATE CUSTOMERS CHANGE AMOUNT = 5000 WHOSE AMOUNT = 3000

(c)

UPDATE CUSTOMERS SET AMOUNT = 5000 WHERE AMOUNT = 3000

(d)

UPDATE CUSTOMERS SET AMOUNT = 5000 WHOSE AMOUNT = 3000

Answer:

Option (c)

14.

Write SQL statements (Query) for following tables:

Customers (CustomerID, CustomerName, ContactNo, City, PostalCode, Country, Amount)

UPDATE POSTAL CODE OF ALL CUSTOMERS TO NULL WHOSE CUSTOMER ID BETWEEN 202 & 204.

(a)

UPDATE CUSTOMERS SET POSTALCODE IS NULL WHERE CUSTOMERID > 202 AND CUSTOMERID > 204

(b)

UPDATE CUSTOMERS SET POSTALCODE = NULL WHERE CUSTOMERID > 202, CUSTOMERID > 204

(c)

UPDATE CUSTOMERS SET POSTALCODE EQUAL NULL WHERE CUSTOMERID > 202 AND CUSTOMERID > 204

(d)

UPDATE CUSTOMERS SET POSTALCODE = NULL WHERE CUSTOMERID > 202 AND CUSTOMERID > 204

Answer:

Option (d)

15.

Write SQL statements (Query) for following tables:

Customers (CustomerID, CustomerName, ContactNo, City, PostalCode, Country, Amount)

UPDATE CUSTOMER NAME, CONTACT NUMBER & CITY to KARTIK JAIN, 98980 95263 & VIRPUR WHOSE CUSTOMER ID IS 201.

(a)

UPDATE CUSTOMERS SET CUSTOMERNAME = 'KARTIK JAIN', CONTACTNO = '98980 95263', CITY = 'VIRPUR' WHERE CUSTOMERID = 201

(b)

UPDATE CUSTOMERS SET CUSTOMERNAME = 'KARTIK JAIN', CONTACTNO = '98980 95263', CITY = 'VIRPUR' WHOSE CUSTOMERID = 201

(c)

UPDATE CUSTOMERS SET CUSTOMERNAME = 'KARTIK JAIN' AND CONTACTNO = '98980 95263' AND CITY = 'VIRPUR' WHERE CUSTOMERID = 201

(d)

UPDATE CUSTOMERS SET CUSTOMERNAME = 'KARTIK JAIN' AND CONTACTNO = '98980 95263' AND CITY = 'VIRPUR' WHOSE CUSTOMERID = 201

Answer:

Option (a)

16.

Write SQL statements (Query) for following tables:

Customers (CustomerID, CustomerName, ContactNo, City, PostalCode, Country, Amount)

ADD ONE MORE COLUMN ADDRESS IN CUSTOMER TABLE.

(a)

ALTER TABLE CUSTOMERS ALTER ADDRESS VARCHAR (500)

(b)

ALTER TABLE CUSTOMERS INSERT ADDRESS VARCHAR (500)

(c)

ALTER TABLE CUSTOMERS ADD ADDRESS VARCHAR (500)

(d)

ALTER TABLE CUSTOMERS ADD COLUMN ADDRESS VARCHAR (500)

Answer:

Option (c)

17.

Write SQL statements (Query) for following tables:

Customers (CustomerID, CustomerName, ContactNo, City, PostalCode, Country, Amount)

CHANGE DATATYPE OF CONTACT NUMBER TO VARCHAR (50).

(a)

ALTER TABLE CUSTOMERS CHANGE COLUMN CONTACTNO VARCHAR (50)

(b)

ALTER TABLE CUSTOMERS MODIFY COLUMN CONTACTNO VARCHAR (50)

(c)

ALTER TABLE CUSTOMERS ALTER COLUMN CONTACTNO VARCHAR (50)

(d)

ALTER TABLE CUSTOMERS MODIFY CONTACTNO VARCHAR (50)

Answer:

Option (c)

18.

Write SQL statements (Query) for following tables:

Customers (CustomerID, CustomerName, ContactNo, City, PostalCode, Country, Amount)

CHANGE COLUMN NAME CITY TO CITYNAME.

(a)

SP_RENAME 'CUSTOMERS.CITY', 'CITYNAME', 'COLUMN'

(b)

SP_RENAME 'CUSTOMERS.CITY' TO 'CITYNAME', 'COLUMN'

(c)

SP_RENAME 'CUSTOMERS.CITY' CHANGE 'CITYNAME', 'COLUMN'

(d)

SP_RENAME 'CUSTOMERS.CITY' MODIFY 'CITYNAME', 'COLUMN'

Answer:

Option (a)

19.

Write SQL statements (Query) for following tables:

Customers (CustomerID, CustomerName, ContactNo, City, PostalCode, Country, Amount)

REMOVE COLUMN POSTAL CODE FROM CUSTOMER TABLE.

(a)

ALTER TABLE CUSTOMERS DELETE COLUMN POSTALCODE

(b)

ALTER TABLE CUSTOMERS DROP COLUMN POSTALCODE

(c)

ALTER TABLE CUSTOMERS REMOVE COLUMN POSTALCODE

(d)

ALTER TABLE CUSTOMERS TRUNCATE POSTALCODE

Answer:

Option (b)

20.

Write SQL statements (Query) for following tables:

Customers (CustomerID, CustomerName, ContactNo, City, PostalCode, Country, Amount)

CHANGE TABLE NAME CUSTOMER TO CUSTOMER_DETAILS.

(a)

RENAME 'CUSTOMERS', 'CUSTOMER_DETAILS'

(b)

SP_RENAME 'CUSTOMERS' RENAME 'CUSTOMER_DETAILS'

(c)

SP_RENAME 'CUSTOMERS' TO 'CUSTOMER_DETAILS'

(d)

SP_RENAME 'CUSTOMERS', 'CUSTOMER_DETAILS'

Answer:

Option (d)

Showing 11 to 20 out of 68 Questions