0% found this document useful (0 votes)
4 views5 pages

Databases and SQL

The document contains a series of true or false statements regarding MySQL concepts, multiple choice questions related to SQL commands and definitions, short questions that require explanations of database terms and commands, and long questions that ask for SQL queries based on given tables. It covers various aspects of database management, including data definition, manipulation, and specific SQL commands. The content is structured to test knowledge of SQL and relational database concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Databases and SQL

The document contains a series of true or false statements regarding MySQL concepts, multiple choice questions related to SQL commands and definitions, short questions that require explanations of database terms and commands, and long questions that ask for SQL queries based on given tables. It covers various aspects of database management, including data definition, manipulation, and specific SQL commands. The content is structured to test knowledge of SQL and relational database concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

DATABASE -MYSQL

State whether the following statements are True or False

Q1. Duplication of data is known as Data Redundancy.


Q2. An attribute is a set of values of a dissimilar type of data.
Q3. MySQL supports different platforms like UNIX and Windows.
Q4. UPDATE TABLE command is used to create table in a database.
Q5. Null (unavailable and unknown) values are entered by the following command:
INSERT INTO TABLE_NAME VALUES ("NULL");
Q6. ALTER TABLE command is used to modify the structure of the table.
Q7. Each SQL table must have at least one column and one row.
Q8. Foreign key column derives its value from the primary key of the parent table.
Q9. DISTINCT clause is used to remove redundant rows from the result of the SELECT statement.
Q10. SELECT MIN (salary) FROM Employee will return the highest salary from the table.
Q11. Group functions can be applied to any numeric values, some text types and DATE values.

Multiple Choice Questions(MCQ)

Q1. The .................. allows us to perform tasks related to data definition.


(a) DDL (b) TCL (c) DML (d) None of these
Q2. The................. allows us to perform tasks related to data manipulation.
(a) DDL (b) TCL (c) DML (d) None of these
Q3. A.................. is a text that is not executed.
(a) Statement (b) Query (c) Comment (d) Clause
Q4. .................are words that have a special meaning in SQL.
(a) Keyword (b) Literal (c) Variable (d) Table
Q5 Which command helps to open the database for use?
(a) Use (b) Open (c) Distinct (d) Select
Q6. Which of these commands helps to fetch data from relation?
(a) Use (b) Show (c) Fetch (d) Select
Q7. The ...................... keyword eliminates duplicate rows from the results of a SELECT statement.
(a) OR (b)DISTINCT (c) Show (d) ANY
Q8. ......................command helps to see the structure of a table/relation.
(a) Show (b) select (c) describe (d) order by
Q9. .................... is known as range operator in MySQL.
(a) IN (b) DISTINCT (c) IS (d) BETWEEN
Q10. The .................. clause allows sorting of query results by one or more columns.
(a) ALL (b) DISTINCT (c) GROUP BY (d) ORDER BY
Q11. Which clause is used in query to place the condition on groups in MySQL?
(a) WHERE (b)HAVING (c) GROUP BY (d) Both (a) & (b)
Q12. Which of the following is a DDL command?
(a) ALTER (b)SELECT (c) INSERT (d) UPDATE
Q13. Which of the following commands will delete the table from MYSQL databases?
(a) DELETE TABLE (b) DROP TABLE (c) REMOVE TABLE (d) ALTER TABLE
Short Questions:
Q1. Define the following terms: Field, Record, Table , Domain, Cardinality & degree.
Q2. Difference between DDL and DML command.
Q3. Difference between WHERE and Having clause.
Q4. What do you understand by the term candidate key and alternate key in relational database.
Q5. Differentiate between char and varchar datatypes.
Q6. Differentiate between primary key and unique key.
Q7. What is the purpose of order by clause.
Q8. Explain the following clause:
(i) BETWEEN CLAUSE
(ii) IN CLAUSE
(iii) ORDER BY CLAUSE
(iv) GEOUP BY & HAVING CLAUSE
(v) LIKE CLAUSE
(vi) DISTINCT CLAUSE
Q9. Explain the following commands:
(i) UPDATE COMMAND
(ii) DELETE COMMAND
(iii) DROP COMMAND
(iv) ALTER COMMAND
(v) INSERT INTO COMMAND
Q10. What is join? Explain the types of Join.

Long Questions
Q1. Consider the tables EMPLOYEE and SALGRADE given below and answer (a) and

(b)parts of this question.


(a) Write SQL commands for the following statements:

(i) To display the details of all EMPLOYEEs in descending order of DOJ.

(ii) To display NAME and DESIG of those EMPLOYEEs whose SALGRADE is either S02 or S03.

(iii) To display the content of the entire EMPLOYEEs table, whose DOJ is in between ‘09-Feb-
2006’ and ‘08-Aug-2009’.

(iv) To add a new row with the following content:

109,‘Harish Roy’,‘HEAD-IT’,‘S02’,‘9-Sep-2007’,‘21-Apr-1983’

(b) Give the output of the following SQL queries:

(i) SELECT COUNT(SGRADE),SGRADE FROM EMPLOYEE GROUP BY SGRADE;

(ii) SELECT MIN(DOB),MAX(DOJ) FROM EMPLOYEE;

(iii) SELECT SGRADE, SALARY+HRA FROM SALGRADE WHERE SGRADE =’S02’;

Q2. Study the following table and write SQL queries for questions (i) to (iv) and output for (v)

and (vi).

(i) Write SQL query to display Pname, Quantity and Rate for all the orders that are either

Pencil or Pen.

(ii) Write SQL query to display the orders which are not getting any Discount.

(iii) Write SQL query to display the Pname, Quantity and Sale_date for all the orders whose

total cost (Quantity * Rate) is greater than 500.

(iv) Write SQL query to display the orders whose Rate is in the range 20 to 100.

(v) SELECT Pname, Quantity from Orders WHERE Pname LIKE(‘_e%’);

(vi) SELECT Pname, Quantity, Rate FROM Orders Order BY Quantity DESC;
Q3. Write SQL commands for (i) to (vi) on the basis of relations given below:

(i) To show the books of FIRST PUBL. Publishers written by P. Purohit.

(ii) To display cost of all the books published for FIRST PUBL.

(iii) Depreciate the price of all books of EPB publishers by 5%.

(iv) To display the BOOK_NAME and price of the books, more than 3 copies of which have

been issued.

(v) To show total cost of books of each type.

(vi) To show the details of the costliest book.

Q4. Consider the given table and answer the questions.

(i) To show all information of students where capacity is more than the no. of students in
order of rtno.
(ii) To show area_covered for buses covering more than 20 km., but charges less than
80000.
(iii) To show transporter-wise total no. of students travelling.
(iv) To show rtno, area_covered and average cost per student for all routes where average cost
per student is—charges/noofstudents.
(v) Add a new record with the following data:
(11, “Motibagh”,35,32,10, “kisan tours”, 35000)
(vi)Give the output considering the original relation as given:
(a) select sum(distance) from schoolbus where transporter= “Yadav travels”;
(b) select min(noofstudents) from schoolbus;
(c) select avg(charges) from schoolbus where transporter= “Anand travels”;
(d) select distinct transporter from schoolbus;

You might also like