Chapter 14 MySQL
Chapter 14 MySQL
18 July 2012
8. Which statement is used to modify data in a table? A. CHANGE B. MODIFY C. UPDATE D. SAVE AS 9. Which SQL statement is used to delete data from a table? A. DELETE B. DROP C. TRUNCATE D. REMOVE 10. How do you select all the rows from a table named "Student" where the value of the column "FName" starts with "G"? A. SELECT * FROM Student WHERE FName LIKE 'G_' ; B. SELECT * FROM Student WHERE FName='G'; C. SELECT * FROM Student WHERE FName LIKE 'G%' ; D. SELECT * WHERE Student WHERE FName='%G%' ; 11. The OR operator displays a record if ANY of the conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true A. False B. True 12. Which keyword is used to return only different values in a column? A. DIFFERENT B. EXCLUSIVE C. DISTINCT D. UNIQUE 13. Which SQL keyword(s) is/are used to sort the rows in the output: A. SORTED ORDER B. SORT C. SORT BY D. ORDER BY 14. How would you return all the rows from a table named "Item" sorted in descending order on the column "IName"? A. SELECT * FROM Item SORT 'IName' DESC; B. SELECT * FROM Item ORDER BY IName DESC ; C. SELECT * FROM Item ORDER IName DESC ; D. SELECT * FROM Item SORT BY 'IName' DESC ;
15. How can you insert a new row into the "Store" table? A. INSERT (1,'Abc Rice') INTO Store; B. INSERT VALUES (1,'Abc Rice') INTO Store ; C. INSERT INTO Store VALUES (1,'Abc Rice'); D. ADD ROW Store values(1,'Abc Rice'); 16. Which statement is appropriate to change the first name "Madhur" to "Mridul" in the "FName" column in the 'Student' table? A. UPDATE Student SET FName='Mridul' WHERE FName='Madhur' ; B. MODIFY Student SET FName='Madhur' INTO FName='Mridul ; C. UPDATE Student SET FName='Madhur' INTO FName='Mridul' ; D. UPDATE Student SET FName='Madhur' WHERE FName='Mridul' ; 17. How can you delete the rows with marks below 33 in the 'Student' Table? A. DELETE FROM Student WHERE marks <=33; B. DELETE marks < 33 FROM Student ; C. DELETE ROW marks <33 FROM Student; D. DELETE FROM Student WHERE marks <33; Answer the following questions. a) Define the following terms: i) Keyword ii) Clause iii) Statement b) Which statement is used to select a database and make it current? c) How is a database related to table(s)? d) Write SQL statement to view names of all the tables contained in the current database e) Which keyword is used to eliminate redundant data? f) In INSERT INTO statement, while giving data values, how should text values be supplied? g) What is NULL? What happens when you perform arithmetic calculations on NULL values? h) Write SQL statement to display the result of arithmetic expression 78*2 on screen?
Exercises
i) Is there any difference in the output of the following statements : Select * from Emp; SELECT * FROM EMP; j) List two categories into which MySQL statements can be categorized. Give examples of 2 statements in each category. k) Write the minimum number of column(s) that must be specified while creating a table using CREATE TABLE statement.
l) What happens if you give a CREATE TABLE statement to create a table named 'Item' and a table named 'Item' already exists? m) Write any 4 things that are displayed when you display the structure of a table using DESCRIBE statement. n) Consider the following INSERT INTO statement: INSERT INTO Emp(Empid,Salary) VALUES ('I201',25000); What values are assigned to the columns Empid and Salary respectively? o) In which order are the columns displayed when we give a SELECT ___________ statement? p) What is the difference in the output of SELECT statement if we write the keyword ALL in place of DISTINCT? q) What is the purpose of a Column Alias? r) Write the purpose of the following SELECT statement? SELECT Itemcode,IName AS "Item Title" FROM Item; s) What does the Modulus arithmetic operator do? t) List six relational operators used in SQL. u) How are operators with equal priority evaluated in an expression? v) Which statement is used to modify data in a table? w) Which statement is used to remove a column from a table? x) What is the purpose of "ORDER BY" clause?