CH-3 DATABASE PART II MySQL
MULTIPLE CHOICE QUESTIONS:
1. The command used to modify the contents of a table is:
(a) ALTER TABLE (b) SELECT (c) UPDATE
Ans. (c) UPDATE
2. The command used to display the table structure is:
(a) DISPLAY (b) STRUCTURE (c) DESCRIBE
Ans. (c) DESCRIBE
3. A table name should begin with:
(a) Number (b) Alphabet (c) Symbol
Ans. (b) Alphabet
4. The command used to delete the database physically:
(a) DELETE (b) ERASE (c) DROP
Ans. (c) DROP
5. The wildcard character allows finding a match for any string of any length, including zero length.
(a) * (b) % (c) #
Ans. (b) %
6. This operator displays only those records that do not satisfy the specified condition,
(a) AND (b) OR (c) NOT
Ans. (c) NOT
II. FILL IN THE BLANKS:
1. MySQL is named after co-founder Michael Widenius’s daughter,———
2. The number of rows denotes the ——— of the table.
3. The number of ——— denotes the Degree of the table.
4. ——— words are not allowed in a table name.
5. A MySQL statement is terminated by a ———-
6. The underscore wildcard allows finding a match for any ——– character.
III. ANSWER THE FOLLOWING QUESTIONS:
1. Who were the developers of MySQL?
Ans: The developers of the platform were Michael Widenius (Monty), David Axmark and Allan Larsson.
2. Why is MySQL becoming so popular? Give two reasons.
Ans: MySQL is becoming so popular because of many good reasons –
i) MySQL is released under an open-source license. So we have nothing to pay to use it.
ii) MySQL is a very powerful program in its own right. It handles a large subset of the functionality of the most expensive and powerful database packages.
3. What is a constraint? Name any two constraints.
Ans: In MySQL, data validation can be ensured through Constraints while entering data in a table. Constraints are some rules that help ensure the validity of the data while entering data in a table.
The two constraints in MySQL are PRIMARY KEY, NOT NULL.
4. Give examples of DML commands?
Ans: Data Manipulation Language (DML) commands are used to modify the database. It is responsible for all forms of changes in the database. Here are some commands that come under DML:
• INSERT • UPDATE • DELETE
5. What are the characteristics by which you can determine the data type of MySQL?
Ans: A table in a database consists of many fields with specific data types, such as numeric, string or date. The data type can be determined by the following characteristics:
(i) Number of bytes it takes for storage. (ii) Kind of value it represents.
6. What is the query to display the table structure?
Ans: To display complete information about the table structure, the query is:
DESCRIBE table_name; OR DESC table_name;
7. What is the query to display all the records in a table?
Ans: To display all the records in a table, the query is:
SELECT * FROM table_name;
8. List the Arithmetic Operators used in MySQL.
|%||MODULUS OR REMAINDER|
9. List the Relational Operators used in MySQL.
|<> or !=||NOT EQUAL TO|
|<=||LESS THAN OR EQUAL TO|
|>=||GREATER THAN OR EQUAL TO|
10. Differentiate between COUNT(*) and COUNT.
Ans: COUNT() :- Returns the number of values in specified columns/expressions.
COUNT(*):- Returns the number of rows in the table.
11. What are the rules for naming a table in MySQL?
Ans: Rules for Naming a Table:-
⚫ A table name can have a maximum of 30 characters.
⚫ It can contain characters A-Z, a-z and numbers 0-9.
⚫ A table name should begin with an alphabet.
⚫ The special character _ (Underscore) is allowed. It is used for joining two words.
⚫ Reserved words are not allowed. For example, CREATE, SELECT, DROP etc.
12. Explain the five categories of SQL commands?
Ans: There are five types of SQL commands: DDL, DML, DCL. TCL, and DQL.
1. Data Definition Language (DDL)
DDL changes the structure of the table like creating a table, deleting a table, altering a table, etc. All the commands of DDL are auto-committed, which means it permanently saves all the changes in the database.
Here are some commands that come under DDL
2. Data Manipulation Language
DML commands are used to modify the database. It is responsible for all forms of changes in the database. The command of DML is not auto-committed, which means it can’t permanently save all the changes in the database. They can be rollback.
Here are some commands that come under DML:
3. Data Control Language
DCL commands are used to grant and take back authority from any database user.
Here are some commands that come under DCL:
4. Transaction Control Language
TCL commands can only be used with DML commands like INSERT, DELETE and UPDATE only. These operations are automatically committed in the database that’s they cannot be used while creating tables or dropping them.
Here are some commands that come under TCL:
5. Data Query Language
DQL is used to fetch the data from the database.
It uses the commands:
Tq sir for helping 🙏🙏🙏
Thanks sir for your help 🙏🙏
Application Based Questuon dijea pls
Application Based Questuon dijea pls
Thank u sir 🙏🙏