0% found this document useful (0 votes)
60 views2 pages

2019-2020 Mysql Questions

A transaction is a logical unit of work that must succeed or fail entirely. It maintains the ACID properties of atomicity, consistency, isolation, and durability. Transactions can be divided into segments using savepoints, allowing partial rollbacks. COMMIT commits all changes permanently while ROLLBACK undoes changes and returns the database to its prior state. MySQL supports TCL commands like START TRANSACTION, COMMIT, ROLLBACK, and SAVEPOINT to manage transactions.

Uploaded by

Kashyap Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views2 pages

2019-2020 Mysql Questions

A transaction is a logical unit of work that must succeed or fail entirely. It maintains the ACID properties of atomicity, consistency, isolation, and durability. Transactions can be divided into segments using savepoints, allowing partial rollbacks. COMMIT commits all changes permanently while ROLLBACK undoes changes and returns the database to its prior state. MySQL supports TCL commands like START TRANSACTION, COMMIT, ROLLBACK, and SAVEPOINT to manage transactions.

Uploaded by

Kashyap Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

2019-2020 MySQL Questions

1. 1. Define a transaction.
Ans. -A transaction is a logical unit of a work that must succeed or fail in its entirely. It is an atomic
operation which can be divided unto smaller operations.
2. What is a savepoint?
Ans. - Savepoints are special operations that allow you to divide the work of a transaction into
different segments. In case of a failure, you can execute rollbacks to the savepoint only, leaving prior
changes intact
3. Why do understand by transaction COMMIT and ROLLBACK?
Ans-COMMITing a transaction means all the steps of a transaction are carried out successfully and
all data changes are made permanent in the database. Transaction ROLLBACK means transaction
has not been finished completely and hence all data changes made by the transaction in the
database if any, are undone and the database returns to the state as it was before this transaction
execution started.
4. What do you understand by ACID properties of database transaction?
Ans. -To ensure the data-integrity, the database system maintains the following properties of
transaction. The properties given below are termed as ACID properties-an acronym derived from
the first letter of each of the properties.
(i) Atomicity-This property ensures that either all operations of the transactions are reflected
properly in the database, none are. Atomicity ensures either al-or-none operations of a transaction
are carried out.
(ii) Consistency-This property ensures that database remains in a consistent state before the start
of transaction and after the transaction is over.
(iii) Isolation-Isolation ensures that executing transaction execution in isolation i.e. is unaware of
other transactions executing concurrently in the system.
(iv) Durability-This property ensures that after the successful completion of a transaction i. e when
a transaction COMMITs, the changes made by it to the database persist i. e remain in the database
irrespective of other failures
5. What TCL commands are supported by SQL?
Ans. -SQL supports following TCL commands BEGIN |START TRANSACTION-Marks the beginning of
a transaction
COMMIT-Ends the current transaction by saving database changes and starts a new transaction.
ROLLBACK-Ends the current transaction by discarding changes and starts a new transaction.
SAVEPOINT-Defines breakpoints for the transactions to allow partial rollbacks.
SET AUTOCOMMIT-Enables or disable the default autocommit mode.

6. Which statements complete a transaction?


ROLLBACK
Commit
Alter
Start
7. What is MySQL?
MySQL is an open source DBMS which is built, supported and distributed by MySQL AB (now
acquired by Oracle)
8. What are the technical features of MySQL?
MySQL database software is a client or server system which includesMultithreaded SQL server
supporting various client programs and libraries Different backend Wide range of application
programming interfaces and Administrative tools.

1
2019-2020 MySQL Questions

9. Why MySQL is used?MySQL database server is reliable, fast and very easy to use. This software
can be downloaded as freeware and can be downloaded from the internet.
10. What is the default port for MySQL Server?The default port for MySQL server is 3306.
11. Differentiate between ENUM and SET constraints
ENUM is to specify set of predefined values
Create table size(name ENUM('Small', 'Medium','Large');
12. Difference between CHAR and VARCHAR?
CHAR and VARCHAR types differ in storage and [Link] column length is fixed to the length
that is declared while creating table. The length value ranges from 1 and [Link] CHAR values
are stored then they are right padded using spaces to specific length. Trailing spaces are removed
when CHAR values are retrieved.
13. Give string types available for column?The string types are:
• SET• BLOB• ENUM• CHAR• TEXT• VARCHAR
14. How to get current MySQL version?SELECT VERSION ();
15. What is the difference between primary key and candidate key?
1. Every row of a table is identified uniquely by primary key. There is only one primary key for a
table.
2. Primary Key is also a candidate key. By common convention, candidate key can be
designated as primary and which can be used for any foreign key references
16. What do you mean by % and _ in the LIKE statement?
% corresponds to 0 or more characters, _ is exactly one character in the LIKE statement.
17. How can we get the number of rows affected by query?Number of rows can be obtained by
SELECT COUNT (user_id) FROM users;
18. Is Mysql query is case sensitive? No.
19. How to enter Characters as HEX Numbers?
If you want to enter characters as HEX numbers, you can enter HEX numbers with single quotes
and a prefix of (X), or just prefix HEX numbers with (Ox).
A HEX number string will be automatically converted into a character string, if the expression
context is a string.
20. How to display top 50 rows? In MySql, top 50 rows are displayed by using this following query:
SELECT * FROM LIMIT 0,50
21. What is the different between NOW() and CURRENT_DATE()?
NOW () command is used to show current year,month,date with hours,minutes and seconds
CURRENT_DATE() shows current year,month and date only.
22. What do the following functions do?
CONCAT(A, B) – Concatenates two string values to create a single string output. Often used to
combine two or more fields into one single field.
FORMAT(X, D) – Formats the number X to D significant digits.
CURRDATE(), CURRTIME() – Returns the current date or time.
NOW() – Returns the current date and time as one value.
MONTH(), DAY(), YEAR(), WEEK(), WEEKDAY() – Extracts the given data from a date value.
HOUR(), MINUTE(), SECOND() – Extracts the given data from a time value.
DATEDIFF(A, B) – Determines the difference between two dates and it is commonly used to
calculate age
SUBTIMES(A, B) – Determines the difference between two times.
FROMDAYS(INT) – Converts an integer number of days into a date value.

You might also like