Colleen Flashcards
MySQL Interview Q&A
What is the difference between SQL and MySQL or SQL Server?
SQL or Structured Query Language is a language; language that communicates with a relational database thus providing ways of manipulating and creating databases. MySQL and Microsoft’s SQL Server both are relational database management systems that use SQL as their standard relational database language.
What is the difference between SQL and PL/SQL?
PL/SQL is a dialect of SQL that adds procedural features of programming languages in SQL. It was developed by Oracle Corporation in the early 90’s to enhance the capabilities of SQL.
What are various DDL commands in SQL? Give brief description of their purposes.
Following are various DDL or Data Definition Language commands in SQL −
CREATE − it creates a new table, a view of a table, or other object in database. ALTER − it modifies an existing database object, such as a table. DROP − it deletes an entire table, a view of a table or other object in the database.
What are various DML commands in SQL? Give brief description of their purposes.
Following are various DML or Data Manipulation Language commands in SQL −
SELECT − it retrieves certain records from one or more tables. INSERT − it creates a record. UPDATE − it modifies records. DELETE − it deletes records.
What are various DCL commands in SQL? Give brief description of their purposes.
Following are various DCL or Data Control Language commands in SQL −
GRANT − it gives a privilege to user. REVOKE − it takes back privileges granted from user.
Can you sort a column using a column alias?
Yes. A column alias could be used in the ORDER BY clause.
Is a NULL value same as zero or a blank space? If not then what is the difference?
A NULL value is not same as zero or a blank space. A NULL value is a value which is ‘unavailable, unassigned, unknown or not applicable’. Whereas, zero is a number and blank space is a character.
True or False. Give explanation if False.
If a column value taking part in an arithmetic expression is NULL, then the result obtained would be NULLM.
True.
If a table contains duplicate rows, does a query result display the duplicate values by default? How can you eliminate duplicate rows from a query result?
A query result displays all rows including the duplicate rows. To eliminate duplicate rows in the result, the DISTINCT keyword is used in the SELECT clause.
What is the purpose of the condition operators BETWEEN and IN?
The BETWEEN operator displays rows based on a range of values. The IN condition operator checks for values contained in a specific set of values.
How do you search for a value in a database table when you don’t have the exact value to search for?
In such cases, the LIKE condition operator is used to select rows that match a character pattern. This is also called ‘wildcard’ search.
What is the default ordering of data using the ORDER BY clause? How could it be changed?
The default sorting order is ascending. It can be changed using the DESC keyword, after the column name in the ORDER BY clause.
What are the specific uses of SQL functions?
SQL functions have the following uses −
- Performing calculations on data
- Modifying individual data items
- Manipulating the output
- Formatting dates and numbers
- Converting data types
What are the case manipulation functions of SQL?
LOWER, UPPER, INITCAP
Which function returns the remainder in a division operation?
The MOD function returns the remainder in a division operation.