ExamVeda
Login
Home
11
Identify the table name in the following SQL statement.
INSERT INTO student VALUES('Kyle','M',NULL);
Discuss
Answer & Solution
Answer: Option A
Solution:
This SQL statement is about adding new information into a table. The word "INSERT INTO" tells us that we are adding data. The word "VALUES" indicates the data we are adding.
The table name is the one that comes after "INTO". In this case, the table name is "student".
So the answer is Option A: Student
12
The special database that always exists after setting up MySQL in a computer is . . . . . . . .
Discuss
Answer & Solution
Answer: Option C
Solution:
This question asks about a special database that's always present after installing MySQL on your computer. Let's break down the options:
Option A: sampdb - This is not a standard MySQL database.
Option B: mysql - This is the correct answer! The 'mysql' database is essential for managing and configuring your MySQL server. It stores user accounts, permissions, and other crucial information.
Option C: information_schema - This database contains information about other databases within your MySQL setup. It's a helpful resource for understanding your database structure.
Option D: readme_db - This isn't a real database in MySQL.
In conclusion, the 'mysql' database is always there after you install MySQL. It's like the control center for your database system.
13
Which of the following statements is/are correct?
Discuss
Answer & Solution
Answer: Option C
Solution:
This question is about how the NOT operator works in MySQL.
Think of NOT as flipping a switch.
If something is true (the switch is on), NOT(true) makes it false (the switch is off).
If something is false (the switch is off), NOT(false) makes it true (the switch is on).

So, both Option A and Option B are correct.

The answer is Option C.
14
Which clause is used to sort query elements?
Discuss
Answer & Solution
Answer: Option D
Solution:
This question is about sorting the results of a query in MySQL. We want to find the clause that specifically controls the order of the output.
Let's look at the options:
Option A: GROUP - This is used for grouping similar data together. It doesn't directly sort the results.
Option B: GROUP BY - This is also for grouping, similar to Option A. It's not for sorting.
Option C: ORDER - This is a general term for ordering, but it's not the complete clause.
Option D: ORDER BY - This is the correct answer! The ORDER BY clause is what you use to specify the sorting criteria in your SQL query.
So, the answer is Option D: ORDER BY
15
The maximum number of indexes on MyISAM table is . . . . . . . .
Discuss
Answer & Solution
Answer: Option D
Solution:
This question is about MyISAM tables in MySQL, which is a type of table storage engine.
Indexes are special data structures that help MySQL find information in tables faster. Think of them like an index in a book, allowing you to quickly find a specific topic.
MyISAM tables can have more than one index. This means you can create multiple indexes to speed up searches on different columns in your table.
So the answer is Option D: more than 1.
16
For the same input parameters, if the stored function returns the same result, it is called . . . . . . . .
Discuss
Answer & Solution
Answer: Option A
Solution:
Imagine you have a special calculator called a "stored function" in your MySQL database. This calculator does some calculations based on numbers you give it (input parameters).
Let's say you input the same numbers into the calculator twice. If the calculator always gives you the *same* answer both times, it's called deterministic. It's predictable and reliable.
So the correct answer is Option A: deterministic.
17
Find the error in the following SQL statement?
CREATE TABLE person
( person_id SMALLINT, name VARCHAR, LAST VARCHAR, Bith_date DATE
CONSTRAINTS pk_person PRIMARY KEY (person_id));
INSERT INTO person
VALUES( person_id, name, LAST, Birth_date)
(1,’s’,’p’, 24-1991-01);
Discuss
Answer & Solution
Answer: Option A
Solution:
This SQL code has a few errors. Let's break them down:
Error 1: Incorrect Column Names
* In the `CREATE TABLE` statement, you have a column named `LAST`. It should be `Last_name` to follow best practices and avoid confusion. * The column `Bith_date` is misspelled and should be `Birth_date`.
Error 2: Incorrect Syntax for `INSERT INTO`
* The `INSERT INTO` statement has incorrect syntax. You should list the column names and their values directly in the query: `INSERT INTO person (person_id, name, Last_name, Birth_date) VALUES (1, 's', 'p', '1991-01-24');`
Error 3: Incorrect Date Format
* The date format `24-1991-01` is incorrect. MySQL expects the standard format `YYYY-MM-DD`, so it should be `1991-01-24`.
The Correct Statement
```sql CREATE TABLE person ( person_id SMALLINT, name VARCHAR(255), Last_name VARCHAR(255), Birth_date DATE, CONSTRAINT pk_person PRIMARY KEY (person_id) ); INSERT INTO person (person_id, name, Last_name, Birth_date) VALUES (1, 's', 'p', '1991-01-24'); ```
Therefore, the answer is Option A: Incorrect Data Value . The data value for `Birth_date` is in the wrong format.
18
Which of the following statements does not modify the table?
Discuss
Answer & Solution
Answer: Option D
Solution:
This question asks about what Data Manipulation Language (DML) commands are used to change data in a table.
DML commands are like tools that let you add, change, or remove data from a database.
Here's a breakdown of each option:
* Option A: INSERT: This command adds new rows of data to a table. So it does modify the table.
* Option B: UPDATE: This command changes the existing data in a table. So it does modify the table.
* Option C: DELETE: This command removes rows of data from a table. So it does modify the table.
* Option D: SELECT: This command retrieves data from a table, but it doesn't change anything in the table.

Therefore, the answer is Option D: SELECT.
SELECT is used to read data, not to modify it.
19
To see the table structure, which of the following SQL commands is issued?
Discuss
Answer & Solution
Answer: Option A
Solution:
This question asks about how to see the structure of a table in MySQL. The structure of a table refers to its columns, their data types, and other defining characteristics.
Here's a breakdown of the options:
Option A: DESCRIBE tbl_name
This is the correct answer. The DESCRIBE command in MySQL is specifically designed to show the table structure. It lists all the columns, their data types, and other information about the table's definition.
Option B: VIEW tbl_name
VIEW is a virtual table based on a query. It doesn't directly show the structure of the table.
Option C: SELECT TABLE tbl_name
This syntax is incorrect. The SELECT statement is used to retrieve data from a table.
Option D: SELECT tbl_name
This is also incorrect. The SELECT statement is used to retrieve data from a table.
Therefore, the correct answer is Option A: DESCRIBE tbl_name.
20
Suppose you want to select a database named 'sampledb' as the default database. Which of the following commands do you use?
Discuss
Answer & Solution
Answer: Option D
Solution:
This question is about how to tell MySQL which database you want to work with. Imagine you have multiple folders on your computer, and you want to work in a specific folder. In MySQL, you have different databases, and you need to choose the one you want to use.

The command to do this is USE. So the correct answer is Option D: USE sampledb.

Let's break down the options:
* Option A: SELECT DATABASE() This command will tell you the currently selected database, but it won't change it.
* Option B: SELECT DATABASE sampledb This is incorrect syntax, and it wouldn't work.
* Option C: USE DATABASE sampledb This is close, but the DATABASE keyword is unnecessary.
* Option D: USE sampledb This is the correct way to switch to the 'sampledb' database.