Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

How to add users in MySQL?

Answer»

You can add a User by USING the CREATE command and SPECIFYING the necessary credentials. For EXAMPLE:

CREATE USER ‘testuser’ IDENTIFIED BY ‘sample PASSWORD’;

 

2.

What is BLOB in MySQL?

Answer»

BLOB is an acronym that stands for a BINARY large object. It is used to hold a VARIABLE amount of data.
There are FOUR types of BLOB:

  • TINYBLOB
  • BLOB
  • MEDIUMBLOB
  • LONGBLOB

A BLOB can hold a very large amount of data. For example - documents, IMAGES, and even videos. You could store your complete novel as a file in a BLOB if needed.

3.

What are the Temporal Data Types in MySQL?

Answer»
TYPE NameMeaning
DATEA date value, in ' CCYY-MM-DD ' Format
TIMEA Time value, in ' hh : mm :SS ' format
DATETIMEDate and time value, in ' CCYY-MM-DD hh : mm :ss ' format
TIMESTAMPA timestamp value, in ' CCYY-MM-DD hh : mm :ss ' format
YEARA year value, in CCYY or YY format

Example: To select the records with an Order Date of "2018-11-11" from a table:

SELECT * FROM Orders WHERE OrderDate='2018-11-11'
4.

What are the String Data Types in MySQL?

Answer»
Type NameMeaning
CHARfixed-length nonbinary(character) string
VARCHARvariable-length nonbinary string
BINARYfixed-length binary string
VARBINARYvariable-length binary string
TINYBLOBVery small BLOB(binary large object)
BLOBSmall BLOB
MEDIUMBLOBMedium-sized BLOB
LONGBLOBLarge BLOB
TINYTEXTA very small nonbinary string
TEXTSmall nonbinary string
MEDIUMTEXTMedium-sized nonbinary string
LONGTEXTLarge nonbinary string
ENUMAn enumeration; each column value is ASSIGNED, ONE enumeration member
SETA set; each column value is assigned ZERO or more set members
NULLNULL in SQL is the term used to represent a missing value. A NULL value in a table is a value in a field that appears to be blank. This value is different than a zero value or a field that contains spaces.
5.

What are the Numeric Data Types in MySQL?

Answer»

MySQL has numeric data TYPES for integer, fixed-point, floating-point, and BIT values, as shown in the table below. Numeric types can be signed or UNSIGNED, except BIT. A special ATTRIBUTE enables the automatic generation of sequential integer or floating-point COLUMN values, which is useful for applications that require a series of unique identification numbers.

Type NameMeaning
TINYINTVery Small Integer
SMALLINTSmall Integer
MEDIUMINTMedium-sized Integer
INTStandard Integer
BIGINTLarge Integer
DECIMALFixed-point number
FLOATSingle-precision floating-point number
DOUBLEDouble-precision floating-point number
BITBit-field
6.

How do you view a database in MySQL?

Answer»

One can view all the databases on the MYSQL server HOST USING the following command:

mysql> SHOW DATABASES;  

7.

How to Delete Data From a MySQL Table?

Answer»

In MYSQL, the DELETE STATEMENT is USED to delete RECORDS from a table:

DELETE FROM table_nameWHERE column_name = value_name
8.

How to create an Index in MySQL?

Answer»

In MYSQL, there are different index types, such as a regular INDEX, a PRIMARY KEY, or a FULLTEXT index. You can achieve fast searches with the help of an index. Indexes speed up performance by either ordering the data on disk so it's quicker to FIND your RESULT or, telling the SQL engine where to go to find your data.

Example: Adding indexes to the history table:

ALTER TABLE history ADD INDEX(author(10));ALTER TABLE history ADD INDEX(title(10));ALTER TABLE history ADD INDEX(category(5));ALTER TABLE history ADD INDEX(YEAR);DESCRIBE history;
9.

How do you remove a column from a database?

Answer»

You can remove a COLUMN by USING the DROP keyword:

ALTER TABLE classics DROP PAGES;

10.

How do you Insert Data Into MySQL?

Answer»

The INSERT INTO STATEMENT is used to add new records to a MySQL table:

INSERT INTO table_name (column1, column2, COLUMN3,...)VALUES (value1, value2, value3,...)

If we want to add values for all the columns of the table, we do not NEED to SPECIFY the column names in the SQL query. However, the order of the values should be in the same order as the columns in the table. The INSERT INTO syntax WOULD be as follows:

INSERT INTO table_nameVALUES (value1, value2, value3, ...);
11.

How do you create a table using MySQL?

Answer»

Use the following to create a table using MySQL:

CREATE TABLE HISTORY (AUTHOR VARCHAR(128),title VARCHAR(128),type VARCHAR(16),year CHAR(4)) ENGINE InnoDB;
12.

How do you create a database in MySQL?

Answer»

USE the FOLLOWING command to create a new database CALLEDBOOKS’:

CREATE DATABASE books;

13.

What are some of the common MySQL commands?

Answer»
CommandAction
ALTERTo alter a database or table
BACKUPTo back-up a table
\cTo cancel Input
CREATETo create a database
DELETETo delete a row from a table
DESCRIBETo describe a table's columns
DROPTo delete a database or table
EXIT(ctrl+c)To exit
GRANTTo CHANGE user privileges
HELP (\h, \?)DISPLAY help
INSERTInsert data
LOCKLock table(s)
QUIT(\q)Same as EXIT
RENAMERename a Table
SHOWList details about an object
SOURCEExecute a file
STATUS (\s)Display the current status
TRUNCATEEmpty a table
UNLOCKUnlock table(s)
UPDATEUpdate an EXISTING record
USEUse a database
14.

What are MySQL Database Queries?

Answer»

A query is a SPECIFIC request or a QUESTION. One can query a DATABASE for specific INFORMATION and have a RECORD returned.

15.

How can you interact with MySQL?

Answer»

There are THREE main WAYS you can interact with MySQL: 

  • USING a COMMAND line
  • via a web interface
  • through a programming language
16.

What does a MySQL database contain?

Answer»

A MySQL database contains one or more tables, each of which contains RECORDS or rows. Within these rows are VARIOUS COLUMNS or FIELDS that contain the DATA itself.

17.

What does SQL in MySQL stand for?

Answer»

The SQL in MySQL stands for STRUCTURED Query Language. This language is ALSO used in other databases such as Oracle and Microsoft SQL Server.  One can use COMMANDS such as the following to send requests from a database:

SELECT title FROM publications WHERE author = ' J. K. ROWLING’;

Note that SQL is not case sensitive. However, it is a good practice to write the SQL keywords in CAPS and other names and variables in a small case.
18.

What do you mean by ‘databases’?

Answer»

A database is a structured COLLECTION of data stored in a COMPUTER system and ORGANIZED in a WAY to be quickly searched. With databases, information can be rapidly RETRIEVED.

19.

What are some of the advantages of using MySQL?

Answer»
  • Flexibility: MYSQL runs on all operating systems
  • Power: MySQL focuses on performance
  • Enterprise-Level SQL Features: MySQL had for some time been LACKING in advanced features such as subqueries, VIEWS, and stored procedures.
  • Full-Text Indexing and Searching
  • Query Caching: This helps ENHANCE the speed of MySQL greatly
  • Replication: One MySQL server can be duplicated on another, providing numerous advantages
  • Configuration and Security
20.

What is MySQL?

Answer»

MySQL is a database MANAGEMENT system for web SERVERS. It can GROW with the website as it is highly scalable. Most of the WEBSITES TODAY are powered by MySQL.