Close

🔰 MySQL DBA 🔰

Last Updated: 2023-09-23
  1. Can you tell the difference between Mysql_connect And Mysql_pconnect?
  2. Mysql_connect

    Used to open a new connection to a database.

    You can open and close the database connection based on the request.

    Opens a page everytime the page is loaded.

    Mysql_pconnect

    Used to open a persistent connection in a database

    You cannot close the database connection.

    There is no need to open and close a connection everytime a page is loaded.

  3. What is the default port for MySQL server?
  4. MySQL Server’s default port is 3306. Apart from this, another standard default port for the SQL Server in TCP/IP is 1433.

  5. Can you tell what are the different set operations available in MySQL?
  6. The various set operations available in MySQL are as follows:

    UNION – This operation returns all the distinct rows selected by a query

    UNION ALL – This operation returns all the rows selected by a query and also includes all duplicate rows.

    MINUS – This operation returns all the distinct rows selected by the first query but does not select the rows selected by the second query.

    INTERSECT – This operation returns all the distinct rows selected by both queries.

  7. Can you tell the order of SQL SELECT statement?
  8. The order of SQL SELECT statement is as follows:

    SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY.

  9. What is Database White Box Testing?
  10. The Database Whitebox Testing deals with the tables, data model, schema and referential integrity rules. It also deals with the triggers, logical views with database consistency and ACID properties.

  11. What is Database Black Box Testing?
  12. Database Black Box Testing deals with data mapping, data storing and retrieving. The Database Black Box Testing is used for techniques such as Equivalence Partitioning and Boundary Value Analysis.

  13. What is CTE?
  14. An expression which consists of a temporary set of results defined in a SQL statement is said to be a Common Table Expression(CTE).

  15. What are the different tables present in Mysql?
  16. There are mainly five types of tables present in MySQL. Out of all these database engines, the default database engine used in MySQL is MyISAM. Refer below to know the five types of tables:

    MyISAM

    Heap

    Merge

    INNO DB

    ISAM

  17. What is a Cursor?
  18. Considered as a pointer to point to one row in a set of rows, a Cursor is nothing but a control which enables traversal over the records in the table. So, the cursor is used for performing traversing actions such as addition, retrieval, and removal of records in a database.

  19. How can you test for NULL values in a database?
  20. A NULL value is a field with no value present in that particular field. Since the NULL value cannot be compared to any other NULL values, you cannot use the comparison operators such as =, <, or <>. To compare the fields with NULL values, you have to use the IS NULL and IS NOT NULL operator.

    Refer below for Syntax of IS NULL and IS NOT NULL.

    SELECT column_names FROM table_name WHERE column_name IS NULL;SELECT column_names FROM table_name WHERE column_name IS NOT NULL;

  21. Can you elaborate on BLOB and TEXT in MySQL?
  22. BLOB

    BLOB(Binary Large Object) is used to hold a variable amount of data and holds up to 65,535 bytes of data. The following are the four types of BLOB.

    TINYBLOB

    BLOB

    MEDIUMBLOB

    LONGBLOB

    TEXT

    TEXT is used to store string values and holds up to a maximum length of 65,535 characters. The following are the four types of TEXT

    TINYTEXT

    TEXT

    MEDIUMTEXT

    LONGTEXT

  23. Can you tell how can you display the Maximum salary in SQL?
  24. To display the maximum salary in SQL, you can use the inbuilt function called MAX().

  25. What is the difference between the NVL function, IFNULL function, and the ISNULL function?
  26. The NVL function, IFNULL function, and the ISNULL function all of them are used to replace the NULL value with another value. The ORACLE users use the NVL function, MySQL users use the IFNULL function and the SQL servers use the ISNULL function

    For example, let us say we have a column(column_3) which has NULL values.

    So, if you run the below statement, the output you would get is a NULL value.

    SELECT column_1 * (column_2 + column_3) FROM Example_Table

    Now, to overcome this, you can use the above three functions as follows:

    SELECT column_1 * (column_2 + NVL(column_3,0)) FROM Example_TableSELECT column_1 * (column_2 + IFNULL(column_3,0)) FROM Example_TableSELECT column_1 * (column_2 + ISNULL(column_3,0)) FROM Example_Table

  27. What is the difference between GUI Testing and Database Testing?
  28. GUI Testing Database Testing

    Also known as User Interface Testing of Front-end Testing. Also known as Back-End Testing or Data Testing.

    Deals with items that interact with users. Deals with items that are hidden from users.

    Testers need not know SQL. Testers need to know SQL.

    GUI Testing focuses on the outlook of the application Database Testing focuses on the integrity of data in the front end with the data present in the back end

  29. How To Display Nth Highest Salary From A Table In A Mysql Query?
  30. Consider the table named “Employee”.

    Now, to find the Nth salary consider the below statement.

    SELECT DISTINCT(salary) FROM employee ORDER BY salary DESC LIMIT n-1,1

    So, if you want to find out the 7th largest salary, consider the below query.

    SELECT DISTINCT(salary) FROM employee ORDER BY salary DESC LIMIT 6,1

  31. What is the command used to create a database using PHP and MySQL?
  32. The command used to create a database using both PHP and MySQL is mysql_create_db(“Database Name”).

  33. Can you tell the Difference Between Mysql_fetch_object And Mysql_fetch_array?
  34. Both of them are similar but vary with a single difference. Mysql_fetch_object return as object and Mysql_fetch_array returns an array. This means that you cannot access the data by their offsets but can only access through its fields names.

  35. What are the ways in which you can retrieve data in the result set of MySQL using PHP?
  36. The different ways in which you can retrieve data in the result set of MySQL using PHP are as follows:

    mysql_fetch_object: This constant fetches a result row as an object.

    mysql_fetch_array: This constant fetches a result row as an associative array, numeric array or as both.

    mysql_fetch_row: This constant gives us a result row as an enumerated array.

    mysql_fetch_assoc: This constant gives us a result row as an associative array.

  37. Can you tell how many values can Set the function of MySQL to consider?
  38. MySQL’s Set function can take a maximum of 64 values, but can also consider 0 values.

  39. Can you tell the reasons for selecting Lamp(Linux, Apache, MySQL, PHP) instead of any other combination of software programs, servers, and operating system?
  40. The reason behind selecting Lamp stack is very simple. Linux, Apache, MySQL, PHP are open source software. The security of the Linux operating system is much more than Windows. The Apache server is a better server than others in the perspective of functionalities and security. MySQL is one of the most popular open source databases is used with PHP to perform various functionalities.

    Subscribe For Free Demo

  41. Can you tell a way to know the number of days between the two given dates in PHP?
  42. You can simply declare the two dates, and then use the strtotime function to subtract both the dates and find the differences between the days in seconds.

    Consider the below example.

    date1 =’2018-09-15′;

    date2 = ‘2018-10-15’;

    days = (strtotime($date1) – strtotime($date2)) / (60 * 60 * 24);

  43. Can you tell how to find the number of rows in a resultset using PHP?
  44. You can use the mysql_num_rows function to find the number of rows in a resultset.

    Consider the below example.

    output = mysql_query(sql, database_name);number_of_rows = mysql_num_rows(output);echo “The number of forws found are equal to: $number_of_rows”;

  45. What are the functions used to encrypt and decrypt the data present in MySQL?
  46. The function used to encrypt the data is AES_ENCRYPT() and the function used to decrypt the data is AES_DECRYPT().

  47. If you wish to encrypt the username and password using PHP, how will you do that?
  48. You can encrypt the username and password using the following functions respectively:

    SET USERNAME=USERNAME(“Username”);SET PASSWORD=PASSWORD(”Password”);

  49. How can you increase the performance of MySQL SELECT query?
  50. The SELECT statement is used to select data from a database and the data returned is stored in a result table, called the result-set. The SELECT statement can be either individually used or can be used with other statements such as ORDER BY, GROUP BY, and HAVING clause.

    To increase the performance of a MySQL SELECT query, you can use the LIMIT clause to limit MySQL from further search in a table, after collecting the required number of records. Apart from this, we can also use the LEFT JOIN or the RIGHT JOIN to retrieve data from two or more tables.

  51. Can you tell the difference between $message and $$message?
  52. $message and $$message are both PHP variables. $message is used to store the variable data and $$message is used to store the variable of a variable. So basically, data is stored in $message and $$message is used to store the data that can be changed dynamically.

  53. What Is Mysql?
  54. MySQL is a multithreaded, multi-user SQL database management system which has more than 11 million installations. This is the world's second most popular and widely used open source database.

  55. In Which Language Mysql Is Written?
  56. MySQL is written in C and C++ and its SQL parser is written in yacc.

  57. What Are The Technical Specification Of Mysql?
  58. MySQL has the following technical specifications - Flexible structure High performance Manageable and easy to use Replication and high availability Security and storage management

  59. What Is The Difference Between Mysql And SQL?
  60. SQL is known as a standard query language. It is used to interact with the database like MySQL. MySQL is a database that stores various types of data and keeps it safe. A PHP script is required to store and retrieve the values inside the database.

  61. What Is The Difference Between Database And Table?
  62. There is a major difference between a database and a table. The differences are as follows: Tables are a way to represent the division of data in a database while, database is a collection of tables and data. Tables are used to group the data in relation with each other and create a dataset. This dataset will be used in the database. The data which are stored in the table in any form is a part of the database, but the reverse is not true.

  63. Why Do We Use Mysql Database Server?
  64. The MySQL database server is very fast, reliable and easy to use. You can easily use and modify the software. MySQL software can be downloaded free of cost from the internet.

  65. What Are The Different Tables Present In Mysql?
  66. There are many tables that remain present by default. But, MyISAM is the default database engine used in MySQL. There are five types of tables that are present: MyISAM Heap Merge INNO DB ISAM

  67. What Is The Difference Between Char And Varchar?
  68. A list of differences between CHAR and VARCHAR: CHAR and VARCHAR types are different in storage and retrieval. CHAR column length is fixed to the length that is declared while creating table. The length value ranges from 1 and 255. When CHAR values are stored then they are right padded using spaces to specific length. Trailing spaces are removed when CHAR values are retrieved.

  69. What Is The Difference Between Truncate And Delete In Mysql?
  70. The DELETE command is used to delete data from a table. It only deletes the rows of data from the table while, truncate is very dangerous command and should be used carefully because it deletes every row permanently from a table.

  71. How Many Triggers Are Possible In Mysql?
  72. There are only six Triggers allowed to use in MySQL database. Before Insert After Insert Before Update After Update Before Delete After Delete

  73. What Is Heap Table?
  74. Tables that are present in memory is known as HEAP tables. When you create a heap table in MySQL, you should need to specify the TYPE as HEAP. These tables are commonly known as memory tables. They are used for high speed storage on temporary basis. They do not allow BLOB or TEXT fields.

  75. What Is Blob And Text In Mysql?
  76. BLOB is an acronym 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 The differences among all these are the maximum length of values they can hold. TEXT is a case-insensitive BLOB. TEXT values are non-binary strings (character string). They have a character set and values are stored and compared based on the collation of the character set. There are four types of TEXT. TINYTEXT TEXT MEDIUMTEXT LONGTEXT

  77. What Is A Trigger In Mysql?
  78. A trigger is a set of codes that executes in response to some events.

  79. What Is The Difference Between Heap Table And Temporary Table?
  80. Heap tables: Heap tables are found in memory. They are used for high speed storage on temporary basis. They do not allow BLOB or TEXT fields. Heap tables do not support AUTO_INCREMENT. Indexes should be NOT NULL. Temporary tables: The temporary tables are used to keep the temporary data. Sometimes it is very useful in cases to keep temporary data. Temporary table is deleted after current client session terminates. Main differences: The heap tables are shared among clients while temporary tables are not shared. Heap tables are just another storage engine, while for temporary tables you need a special privilege (create temporary table).

  81. What Is The Difference Between Float And Double?
  82. FLOAT stores floating point numbers with accuracy up to 8 places and allocates 4 bytes, on the other hand DOUBLE stores floating point numbers with accuracy up to 18 places and allocates 8 bytes.

  83. What Are The Advantages Of Mysql In Comparison To Oracle?
  84. MySQL is a free, fast, reliable, open source relational database while Oracle is expensive, although they have provided Oracle free edition to attract MySQL users. MySQL uses only just under 1 MB of RAM on your laptop while Oracle 9i installation uses 128 MB. MySQL is great for database enabled websites while Oracle is made for enterprises. MySQL is portable.

  85. What Are The Disadvantages Of Mysql?
  86. MySQL is not so efficient for large scale databases. It does not support COMMIT and STORED PROCEDURES functions version less than 5.0. Transactions are not handled very efficiently.

  87. What Is The Difference Between Mysql_connect And Mysql_pconnect?
  88. Mysql_connect: It opens a new connection to the database. Every time you need to open and close database connection, depending on the request. Opens page every time when it loaded. Mysql_pconnect: In Mysql_pconnect, "p" stands for persistent connection so it opens the persistent connection. the database connection can not be closed. it is more useful if your site has more traffic because there is no need to open and close connection frequently and every time when page is loaded.

  89. What Does " I_am_a_dummy Flag" Do In Mysql?
  90. The " i_am_a_dummy flag" enables MySQL engine to refuse any UPDATE or DELETE statement to execute if the WHERE clause is not present.

  91. How To Get The Current Date In Mysql?
  92. To get current date, use the following syntax: SELECT CURRENT_DATE();

  93. What Are The Security Alerts While Using Mysql?
  94. Install antivirus and configure the operating system's firewall. Never use the MySQL Server as the UNIX root user. Change root username and password Restrict or disable remote access.

  95. How To Change A Password For An Existing User Via Mysqladmin?
  96. Mysqladmin -u root -p password "newpassword".

  97. What Is The Difference Between Unix Timestamps And Mysql Timestamps?
  98. Actually both Unix timestamp and MySQL timestamp are stored as 32-bit integers but MySQL timestamp is represented in readable format of YYYY-MM-DD HH:MM:SS format.

  99. How To Display Nth Highest Salary From A Table In A Mysql Query?
  100. Let us take a table named employee. To find Nth highest salary is: 1. select distinct(salary) from employee order by salary desc limit n-1,1 if you want to find 3rd largest salary: 1. select distinct(salary) from employee order by salary desc limit 2,1

  101. What Is Mysql Default Port Number?
  102. MySQL default port number is 3306.

  103. What Is Regexp?
  104. REGEXP is a pattern match using regular expression. Regular expression is a powerful way of specifying a pattern for a complex search.

  105. How Many Columns Can You Create For An Index?
  106. You can create maximum of 16 indexed columns for a standard table.

  107. What Is The Difference Between Now() And Current_date()?
  108. NOW() command is used to show current year, month, date with hours, minutes and seconds while CURRENT_DATE() shows the current year with month and date only.

  109. Which Command Is Used To View The Content Of The Table In Mysql?
  110. The SELECT command is used to view the content of the table in MySQL.

  111. What Is The Usage Of I-am-a-dummy Flag In Mysql?
  112. In MySQL, the i-am-a-dummy flag makes the MySQL engine to deny the UPDATE and DELETE commands unless the WHERE clause is present.

  113. What Is The Usage Of Regular Expressions In Mysql?
  114. In MySQL, regular expressions are used in queries for searching a pattern in a string. * Matches 0 more instances of the string preceding it. + matches 1 more instances of the string preceding it. ? Matches 0 or 1 instances of the string preceding it. . Matches a single character. matches a or b or z | separates strings ^ anchors the match from the start. "." Can be used to match any single character. "|" can be used to match either of the two strings REGEXP can be used to match the input characters with the database. Example: The following statement retrieves all rows where column employee_name contains the text 1000 (example salary): Select employee_name From employee Where employee_name REGEXP '1000' Order by employee_name

  115. How Do You Determine The Location Of Mysql Data Directory?
  116. The default location of MySQL data directory in windows is C:mysqldata or C:Program FilesMySQLMySQL Server 5.0 data.

  117. What Is Mysql Data Directory?
  118. MySQL data directory is a place where MySQL stores its data. Each subdirectory under this data dictionary represents a MySQL database. By default the information managed my MySQL = server mysqld is stored in data directory.

  119. What Is The Use Of Mysql_close()?
  120. Mysql_close() cannot be used to close the persistent connection. Though it can be used to close connection opened by mysql_connect().

  121. How Is Myisam Table Stored?
  122. MyISAM table is stored on disk in three formats. '.frm' file : storing the table definition '.MYD' (MYData): data file '.MYI' (MYIndex): index file

  123. What Is The Usage Of Enums In Mysql?
  124. ENUMs are used to limit the possible values that go in the table: For example: CREATE TABLE months (month ENUM 'January', 'February', 'March'); INSERT months VALUES ('April').

  125. What Are The Advantages Of Myisam Over Innodb?
  126. MyISAM follows a conservative approach to disk space management and stores each MyISAM table in a separate file, which can be further compresses, if required. On the other hand, InnoDB stores the tables in tablespace. Its further optimization is difficult.

  127. Define MySql
  128. MySQL, a multi-user SQL Database Management System that contains eleven million plus installations. MySQL DBA is the second most widespread and extensively utilized open-source Database.

  129. List out the technical specifications of MySql
  130. Below are the MySql technical specifications:

    Security and Storing management

    Stretchy structure

    Replication and high accessibility

    Best performance

    Controllable and user-friendly

  131. What is the purpose of using Mysql Database Server?
  132. The MySQL Database server is quite rapid, consistent, and simple for usage. It is easy for the user to use and make changes to the software.

  133. Provide the various database engines present in MySQL
  134. Below are the different database engines in Mysql:

    Federated

    INNODB

    CSV

    Memory

    MyISAM

  135. In Mysql Database, how many triggers are probable?
  136. Only six (6) triggers are allowed in Mysql Database for use.

  137. Mention the six (6) triggers allowed in Mysql Database
  138. The six (6) triggers allowed in Mysql Database are given below:

    After Update

    After Insert

    Before Update

    After Delete

    Before Delete

    Before Insert

  139. How many tables are present in Mysql Database?
  140. There are five (5) tables in Mysql Database

  141. Mention the different tables available in Mysql Database
  142. Five (5) tables available in Mysql Database are provided below:

    Heap

    MyISAM

    Merge

    ISAM

    INNO DB

  143. Which is the default database engine utilized in Mysql Database?
  144. MyISAM is said to be the default database engine utilized in Mysql Database.

  145. Define ‘Delete’ in Mysql Database
  146. ‘DELETE’is for deleting data from a table. This command is used to delete only the rows of data from a table.

  147. Define ‘Truncate’ in Mysql Database
  148. ‘Truncate’ is to delete every row from a table permanently. Hence, this is said to be a dangerous command.

  149. Define ‘Heap’ table
  150. Heap tables are the ones that are existing in memory. In Mysql, while creating a heap table, users must specify the type as ‘HEAP’. Also, these tables are usually named as Memory tables. Heap tables are used for large speed storage in a momentary manner.

  151. What are the fields not allowed in Heap table?
  152. TEXT or BLOB fields are not allowed in Heap table.

  153. Define BLOB
  154. BLOB (Binary Large Object) is for holding a variable quantity of data.

  155. What are the types of BLOB?
  156. Four types of BLOBs are given below:

    TINYBLOB

    LONGBLOB

    MEDIUMBLOB

    BLOB

  157. Explain TEXT inMysql DBA
  158. TEXT, a case-insensitive BLOB and the text values are always non-binary strings, having a character set and values stockpiled and related depending on the character set collation.

  159. How many TEXT types are available in Mysql DBA?
  160. There are four (4) types of TEXT available in Mysql DBA

    TINYTEXT

    LONGTEXT

    MEDIUMTEXT

    TEXT

  161. Mention any one disadvantage of Mysql DBA
  162. Mysql DBA does not support STORED PROCEDURES and COMMIT functions which have a lesser version of 5.0.

  163. What is the command to retrieve the current date in Mysql DBA
  164. Below is the syntax to retrieve the current date in Mysql DB

    SELECT CURRENT_DATE();

  165. List out the security alerts when using Mysql
  166. Below are the security alerts while using Mysql

    Confine or deactivate the remote access

    Install antivirus and configure the operating security system

    Modify the origin username and password

    MySQL Server is never used as the UNIX root user

  167. Mention the Mysql DBA Default Port Number
  168. 3306 is the default port number of Mysql DBA

  169. Provide the command required to view the table content in Mysql DBA
  170. SELECT command is the one to view the table content in MySQL

  171. Mention the advantage of Mysql_close()
  172. Mysql_close() is used to close connection which are opened by mysql_connect().

  173. What is the benefit of Enums In Mysql?
  174. The purpose of ENUMs is to restrict and limit the probable values that get inside the table.

  175. Give an example for Enums in Mysql
  176. CREATE TABLE weeks (week ENUM ‘Monday’, ‘Tuesday’, ‘Wednesday’); INSERT weeks VALUES (‘Thursday’).

  177. Describe Sqlyog
  178. SQLyog program is the top-most GUI tool for admin. Also, Sqlyog is the widespread MySQL manager. MySQL administrator, PHPMyAdmin and MySQL GUI tools and others MySQL front ends are combined by Sqlyog.

  179. What is the command to verify whether Mysql is running or not?
  180. The command “service mysqld status” in RedHat and “service MySQL status” helps in verifying whether Mysql is running or not.

  181. What is the command to stop/start the service in Mysql?
  182. The command “service mysqld start” is to start MySql service and “service mysqld stop” to stop the service.

  183. Mention the finest installation procedure for MySQL
  184. RPM Installation, Binary Installation, and Source Code compilation are the best installation methods in Mysql.

  185. What is the best RAID level suitable for Mysql?
  186. RAID 10 is the best RAID level suitable for Mysql

  187. Give the different types of logs available in Mysql DBA
  188. Below are the different types of logs:

    Error Log

    General Log

    Slow Query Log

    Binary Log

  189. What is the command to check the Mysql server uptime?
  190. SHOW GLOBAL STATUS LIKE ‘UPTIME’ is the command to check Mysql server uptime

  191. Provide the drawbacks of using big Query cache size?
  192. Query cache pushes an extra load on the database. It forces the DB to perform the task on nullifying the queries from the cache.

  193. Give the optimum size of InnoDB buffer cache
  194. Optimum size of InnoDB buffer cache must be 70-80% of the existing memory.

  195. How do you take incremental backup in Mysql DBA?
  196. To take increment backup in Mysql DBA, use Using percona xtrabackup.

  197. What is the process to perform if you find the data disk full?
  198. In-case of data disk is full, create a soft link and try to move the .idb and .frm files to the linked place.

  199. How many types of backup are available in Mysql DBA?
  200. There are three main types of backup in Mysql DBA which are Cold backups, Logical backups, and Hot backups.

  201. Explain Cold backup
  202. Cold backups is used to shut down the database server and taking a backup of all the data files by creating a copy of those files to another directory. The whole data dir including log files, binlogs, and /etc/my.cnf config file is also backed up.

  203. Explain Logical Backup
  204. Logical backups used a tool called mysqldump tool. This tool locks the tables while it runs to uphold the reliability of modifying data and can result in downtime. The subsequent dump file contains CREATE INDEX, CREATE TABLE, and CREATE DATABASE statements for database build.

  205. Explain Hot Backup
  206. Hot backups permits to back up the physical database data files when the server is up and running. This kind of backup process can be achieved using xtrabackup tool which is available from Percona.

  207. What is the primary key?
  208. Primary Key is to exclusively recognize each row of the table and there can be only one primary Key in a table.

  209. For creating an index, how many columns can be used?
  210. Maximum of 16 columns can be used for creating index.

  211. Describe Database White Box Testing
  212. The Database Whitebox Testing handles data model, schema, and referential integrity rules. In addition, it also handles logical view with database uniformity, triggers, and ACID properties.

  213. Describe Database Black Box Testing
  214. Database Black Box Testing handles data storing & retrieving and data mapping. Also, this kind of testing is also used for techniques such as Boundary Value Analysis and Equivalence Partitioning.

  215. Define CTE
  216. CTE (Common Table Expression) is the one consisting of a momentary set of outcomes demarcated in a SQL statement.

  217. If you want to display the maximum salary, what is the function to be used?
  218. You can use the function MAX() to display the maximum salary.

  219. Explain CSV tables
  220. CSV is an abbreviation of Comma-Separated Values. CSV table is the one to store data in tabular format and plain text. CSV naturally holds only one record per line.

  221. Describe Mysql_connect
  222. Using Mysql_connect, user can open and close the database connection depending on the appeal.

  223. Describe Mysql_pconnect
  224. Mysql_pconnect is used to open a determined connection in a database and not possible to close such a connection.

  225. Define ACID
  226. ACID is the acronym of Atomicity, Consistency, Isolation, and Durability. ACID Property is the top-most vital segment of the database.

  227. What are the different types of MySQL functions?
  228. Strings functions

    Numeric functions

    Date functions

    Aggregate functions

  229. Write a query to create, insert, update and delete?
  230. Create Query: CREATE DATABASE DatabaseName;

    Insert Query : INSERT INTO table_name (tablecolumn1, tablecolumn1,

    tablecolumn1,…)VALUES (value1, value2, value3,…);

    Update Query: UPDATE table_name SET tablecolumn1=value, tablecolumn2=value2,…

    WHERE this_column=this_value;

    Delete Query: DELETE FROM table_name WHERE this_column = this_value;

  231. What is the syntax to connect the mysql?
  232. $connection = new mysqli($localhost, $username, $password);

  233. What is the syntax for concatenating tables in MySQL?
  234. concat(‘value1’, ‘ ’ , ‘value2’);

  235. What is the difference between mysql_fetch_array and mysql_fetch_object?
  236. Mysql_fetch_object is the function which helps to retrieve the values as an object from

    the database, whereas Mysql_fetch_array will return the values as an array.

  237. How Do You Get The Number Of Rows Affected By Query?
  238. It can be got by using the Count();

  239. Name any five combination queries that we use in MySQL?
  240. Like

    Orderby

    Limit

    Between

    Group by

  241. What is the query used to combine two tables and retrieve the value?
  242. Join query is used to combine two tables

  243. What are the ways in which you can retrieve data in the result set of MySQL using PHP?
  244. We can retrieve data in four ways. They are as follows.

    mysql_fetch_array

    mysql_fetch_assoc

    mysql_fetch_object

    mysql_fetch_row

  245. What is the MySQL default port number?
  246. 3306

  247. What is the query to display the top 10 rows?
  248. It can be displayed by using a limit function in the select query.

  249. Write a query to count the number of rows of a table in MySQL
  250. Select COUNT(*) FROM tableName

  251. What is the use of the Primary key? Where we use it.?
  252. The primary key is used to uniquely identify the table records. Mostly we use a primary key

    for IDs.

  253. What are the different types of joins?
  254. There are four types of joins,

    Inner join

    Outer join

    Left join

    Right join

  255. Explain the differences between delete, drop and truncate?
  256. Delete: Delete the row value where conditions meet.

    Drop: remove the table or database completely.

    Truncate: Remove all the rows in the table in time.

  257. How to sort the value while retrieving records from the table?
  258. The value can be sorted by using the OrderBy keyword in the select query.

  259. What is the use of Now()?
  260. It is used to return the current date and time.

  261. Which MySQL function is used to concatenate string?
  262. concat(‘value1’, ‘ ’ , ‘value2’);

  263. What is the query used to add and remove any column of a table?
  264. ALTER query is used to add and remove the column in the table.

  265. List the Sailent features of MySQL?
  266. It is easy to use and reliable

    It is an open-source

    It mainly supports all programming languages

  267. What would be the default port number of MySQL
  268. Default port number is 3306

  269. What do you understand by the term myisamchk?
  270. It is a database utility tool which is used to get some information about MyISAM database tables

  271. Give the main difference between VARCHAR and CHAR data types?
  272. Both are used to store string data under the field of a table

  273. Is it possible to add or remove any column from a table?
  274. Yes. It is possible by using the add column or alter column we can do it.

  275. Define Index?
  276. The index is defined as a data structure of a MySQL table and can speed up with queries.

  277. Explain about the view in MySQL?
  278. It works as a virtual table used to store query and returns a result.

  279. What Are The Differences Between Mysql_fetch_array(), Mysql_fetch_object(), Mysql_fetch_row()?
  280. Mysql_fetch_object is used to retrieve the result from the database as objects while mysql_fetch_array returns result as an array. This will allow access to the data by the field names. For example: Using mysql_fetch_object field can be accessed as $result->name. Using mysql_fetch_array field can be accessed as $result->. Using mysql_fetch_row($result) where $result is the result resource returned from a successful query executed using the mysql_query() function. Example: 1.$result = mysql_query("SELECT * from students"); 2.while($row = mysql_fetch_row($result)) 3.{ 4.Some statement; 5.}

  281. How Do You Backup A Database In Mysql?
  282. It is easy to backing up data with phpMyAdmin. Select the database you want to backup by clicking the database name in the left hand navigation bar. Then click the export button and make sure that all tables are highlighted that you want to backup. Then specify the option you want under export and save the output.

  283. What Is Sqlyog?
  284. SQLyog program is the most popular GUI tool for admin. It is the most popular MySQL manager and admin tool. It combines the features of MySQL administrator, phpMyadmin and others MySQL front ends and MySQL GUI tools.

  285. Write a program using the SELECT statement, While Loop.
  286. You can write a program to select the students details from the student table and use the loop to just print the name of students.

    example_query = mysql_query(“SELECT * FROM ‘students’ WHERE ‘student_id’ = ‘1’;”);while(output = mysql_fetch_array(example_query)){echo output[‘Students_Name’];}

  287. How can you take the backup and restore a MySQL database using PHP?
  288. MySQL comes with a utility mysqldump to provide the database backup and restore. The command you can use for backup and restore are as follows respectively.

    //To take the backup of databasemysqldump database > backup -file.sql;//To restore the databasemysqldump database < backup -file.sql;

    You can also use the phpMyAdmin user interface to backup your database. If you wish to backup, the database you just have to click on the “export” link on the phpMyAdmin main page.

  289. Can you tell the difference between ereg_replace() and eregi_replace()?
  290. ereg_replace and eregi_repalce() are regular expressions used to replace the matching characters. The only difference between these functions are eregi_replace() function ignores the case distinction when it matches alphabetic characters.

  291. How to copy data from one server to another using PHP?
  292. You can use the following three options:

    Option 1: You can use the PHP Copy to move files from server to server. Refer to the syntax below:

    /* Copy the file from source url to server */$copy = copy( $remote_file_url, $local_file );

    Option 2: You can use the PHP FTP to move files from server to server. Refer to the syntax below.

    /* Download $remote_file and save to $local_file */ftp_get($connect_it,$local_file,$remote_file,FTP_BINARY)

    Option 3: You can use the ZIP and UNZIP Files option in PHP.

  293. Can you tell few best practices to be followed for optimization in SQL?
  294. The best practices to be followed for SQL optimizations depend on the individual to individual, but the following list consists of the most popular practices that are advised to follow. Refer below.

    Try avoiding prefixing your stored procedure names with “sp_”.

    It is recommended to use the column list in INSERT statements.

    Preferably use the ANSI-Standard JOIN Clauses rather than the Old style clauses.

    While using SELECT statement, avoid using * queries.

    Do not use double quotes in T-SQL code.

    Try avoiding to use column numbers in the ORDER BY clause.

    Try using table aliases if your SQL statement involves more than a single source.

  295. Can you tell what are various ways to create an index?
  296. The various options to create an index are as follows:

    You can create an index using the T-SQL statements.

    You can use the SQL Server Management Studio. In this, you can browse to the table you need to create an index and then right click on the Indexes node. Over here you have to choose the New Index option.

    You can indirectly identify the index by defining the PRIMARY KEY and the UNIQUE constraint within the CREATE TABLE or ALTER TABLE statement.

  297. What is the difference between a Heap table and Temporary table?
  298. Heap Table Temporary Table

    Heap Table exists in the memory A temporary table is valid only during the session.

    Heap Tables are shared among a various number of clients. Temporary tables are not shared among the clients.

    Temporary tables need a special privilege to create tables. Heap Tables are storage engines which do not need special privileges.

  299. Why do you think it is advised to not to use GUID and CHARACTER columns as Clustered Index arrays?
  300. GUID columns affect the clustered index sorting performance as the nature of the random GUID value generated is larger than the integer data types.

    CHARACTER columns affect the sorting performance of the character data types, larger-size values, non-increasing values, and non-static values which often tend to change. These values cannot be compared as binary values, as the characters comparison mechanism depends on the used collection.

  301. How can you handle the –secure-file-priv in MySQL?
  302. –secure-file-priv option limits the MySQL Server from loading the directories using the LOAD DATA INFILE.

    If you wish to see the directory that has been configured then you may use the SHOW VARIABLES LIKE “secure_file_priv”;

    You have mainly two options to tackle:

    Either move your file to the directory specified by the secure-file-priv.

    Or you can disable secure-file-priv. You cannot disable this later on, and you have to remove it from the start itself.

  303. What is the difference between B-Tree and Hash Indexes?
  304. B-Tree Hash Indexes

    A B-Tree index can be used for column comparisons like =, >, <, >=, <= or BETWEEN operators. A Hash-Index can be only used for equality comparisons that use =, >=, <=.

    B-Tree can be used to search the next entry in the order. Hash Index cannot be used to search for the next entry in the order.

    Any leftmost prefix of the key can be used to find the rows. Only whole keys are used to find a row.

  305. Where is the MyISAM table stored?
  306. Each and every MyISAM Table is stored on disk in the following three files:

    .frm file – Stores the table definition.

    .MYD file – A data file has an MYData extension.

    .MYI index file – The index file has an MYIndex extension.

  307. State the differences between MongoDB and MySQL.
  308. MongoDB MYSQL

    An open source database that stores JSON like documents which vary in structure. An open source relational database management system which stores relational data.

    Each and every individual record are stored as documents. Each and every individual record are stored as rows in a table.

    Documents from a particular class or a group are stored in a collection. A similar type of records are stored in a table.

  309. Identify what is wrong in the below query.
  310. SELECT EmployeeID, AVG(Salary)FROM EmployeeDetails WHERE AVG(Salary) > 75GROUP BY EmployeeID

  311. What is Normalization and list the different types of normalization?
  312. Normalization is the process of organizing data to avoid duplication and redundancy. There are many successive levels of normalization. These are called normal forms. Each consecutive normal form depends on the previous one. The first three normal forms are usually adequate.

    First Normal Form (1NF) – No repeating groups within rows

    Second Normal Form (2NF) – Every non-key (supporting) column value is dependent on the whole primary key.

    Third Normal Form (3NF) – Dependent solely on the primary key and no other non-key (supporting) column value.

  313. Consider you have a composite index of three columns. Now, you have to provide the value of two columns in the WHERE clause of a SELECT query. Do you think Index can be used for the operation?
  314. Usage of index completely depends on if you consider the primary index or not. Consider you have a student table. Now, suppose if an Index is present on StudentID, StudentFirstName, and StudentLastName then you can consider a query as follows:

    SELECT * FROM StudentDetails WHERE StudentID=3 and StudentFirstName=’Jatin’

  315. Suppose you have to collect the first name, middle name and the last name of students from the below table. But, you observe that there few missing values either in the first name, middle name and the last name columns. How will you return the first non-null values?
  316. StudentID FirstName MiddleName LastName

    1 Rohit Kumar NULL

    2 Sakshi Chowdhary NULL

    3 NULL Yash Singhania

    4 Akash NULL Kumar

    5 Avinash NULL Daksh

    You can use the COALESCE function to return the first non-null value from the table. Consider the below query.

    SELECT StudentID, COALESCE(FirstName, MiddleName, LastName) as Name FROM StudentDetails;

  317. Consider a scenario where you have two to three tables with thousand tuples in each of them. Now, if you have to perform a JOIN operation between them will you choose to perform filtering of rows or transforming of rows first.
  318. The answer to this question is quite logical. If you have three tables with thousands of tuples in each of them, then you are first supposed to filter the rows in those tables and then transform the table. This would be beneficiary as if you transform the table, then the number of columns may increase reducing the performance. Due to such performance issues, a lot of memory will be used and the output will appear on your screen after quite a long wait of time.

  319. How can you validate emails using a single query?
  320. To validate emails you can use the regular expressions function (REGEXP_LIKE). Consider the below query.

    SELECTEmailFROMEmployeewhere NOT REGEXP_LIKE(Email, ‘[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}’, ‘i’);

  321. Consider a scenario where you have to send an email to a client from the SQL database. How do you think you can achieve this task?
  322. To send an email from the database, you can use the stored procedures. Follow the below procedure to send the emails:

    Configure your SQL Server Mail account.

    Enable the database mail.

    Write a script to send an email. Refer below for the script.

    USE [YourDB]EXEC msdb.dbo.sp_send_dbmail@recipients = ‘abc@example.com; def@example.com;xyz@example.com’@body = ‘ Sample Body Text’,@subject = ‘Example Email’ ;

  323. Consider you have the following three tables which have to be linked together.
  324. Department(Ssn, EmployeeName, EmployeeAge..)EmployeeContactDetails(Ssn, DepartmentID,desc,Ord)EmployeeAddress(Ssn,DepartmentID, desc, Ord)

    The problem statement is to select all the departments from the Department table, with the “desc” field from the EmployeeContactDetails and EmployeeAddress where Ord=1. Now, you have to solve this problem statement with a single query.

    To solve this problem statement you can use the JOINS concept. You simply have to perform a JOIN on the Department.Ssn and the DepartmentID in the other tables.

    Now, if you are sure that the Ssn exists in all the three considered tables, then you can use the INNER JOIN. Also, if you are not sure that you have matching rows, then you can use the LEFT JOIN. Consider the below query.

    SELECT d.Ssn,d.EmployeeName,c.desc ContactDetailsDesc,a.desc AddressDetailsDescfrom Department dinner join EmployeeContactDetails con d.id = c.DepartmentIDinner join address aon d.id = a.DepartmentIDwhere d.EmployeeName = ‘abc’and c.ord = 1and a.ord = 1

  325. If you are assigned a task, to find the information of PROCEDURES. What are the basic commands that you will use to do so?
  326. To check the procedures, you can consider the following query.

    SELECT * FROM SampleSourceWHERE Type=’PROCEDURE’AND NAME IN (‘SP_CONNECTED_AGG’,’SP_UNCONNECTED_AGG’);

    To find the procedures columns information, you can consider the following query.

    SELECT OWNER, OBJECT_NAME, ARGUMENT_NAME, DATA_TYPE, IN_OUT from ALL_ARGUMENTS order by OWNER, OBJECT_NAME, SEQUENCE;

  327. Can you tell which of the following WHERE clauses is faster?
  328. WHERE col * 4 < 16

    WHERE col < 16 / 4

    If we compare both the statements, then the second WHERE clause would be comparatively faster than the first one. That is because, for the first statement, MYSQL would retrieve the value of ‘col’ for each and every row, multiplied by four. After that, it would compare the result to 16. Also, in the first case no Index can be used, and hence it makes it further slow.

  329. What is the main difference between ‘BETWEEN’ and ‘IN’ condition operators?
  330. BETWEEN operator is used to display rows based on a range of values in a row whereas the IN condition operator is used to check for values contained in a specific set of values.

    Example of BETWEEN:

    SELECT * FROM Students where ROLL_NO BETWEEN 10 AND 50;

    Example of IN:

    SELECT * FROM students where ROLL_NO IN (8,15,25);

  331. What are the different types of Collation Sensitivity?
  332. Following are the different types of collation sensitivity:

    Case Sensitivity

    Kana Sensitivity

    Width Sensitivity

    Accent Sensitivity

    Course Curriculum

    Enroll in Mysql DBA Training & Build Your Skills to Next Level

    Instructor-led Sessions Real-life Case StudiesAssignments

  333. In Which Language Mysql Is Written?
  334. MySQL is written in C and C++ and its SQL parser is written in yacc.

  335. What Are The Technical Specification Of Mysql?
  336. MySQL has the following technical specifications –

    Flexible structure

    High performance

    Manageable and easy to use

    Replication and high availability

    Security and storage management

  337. What Is The Difference Between Mysql And SQL?
  338. SQL is known as a standard query language. It is used to interact with the database like MySQL. MySQL is a database that stores various types of data and keeps it safe.

    A PHP script is required to store and retrieve the values inside the database.

  339. What Is The Difference Between Database And Table?
  340. There is a major difference between a database and a table. The differences are as follows:

    Tables are a way to represent the division of data in a database while, database is a collection of tables and data.

    Tables are used to group the data in relation with each other and create a dataset. This dataset will be used in the database. The data which are stored in the table in any form is a part of the database, but the reverse is not true.

  341. Why Do We Use Mysql Database Server?
  342. The MySQL database server is very fast, reliable and easy to use. You can easily use and modify the software. MySQL software can be downloaded free of cost from the internet.

  343. What Is The Difference Between Char And Varchar?
  344. A list of differences between CHAR and VARCHAR:

    CHAR and VARCHAR types are different in storage and retrieval.

    CHAR column length is fixed to the length that is declared while creating table. The length value ranges from 1 and 255.

    When CHAR values are stored then they are right padded using spaces to specific length. Trailing spaces are removed when CHAR values are retrieved.

  345. What Is The Difference Between Truncate And Delete In Mysql?
  346. The DELETE command is used to delete data from a table. It only deletes the rows of data from the table while, truncate is very dangerous command and should be used carefully because it deletes every row permanently from a table.

  347. How Many Triggers Are Possible In Mysql?
  348. There are only six Triggers allowed to use in MySQL database.

    Before Insert

    After Insert

    Before Update

    After Update

    Before Delete

    After Delete

  349. What Is Heap Table?
  350. Tables that are present in memory is known as HEAP tables. When you create a heap table in MySQL, you should need to specify the TYPE as HEAP. These tables are commonly known as memory tables. They are used for high speed storage on temporary basis. They do not allow BLOB or TEXT fields.

  351. What Is A Trigger In Mysql?
  352. A trigger is a set of codes that executes in response to some events.

  353. What Is The Difference Between Heap Table And Temporary Table?
  354. Heap tables:

    Heap tables are found in memory. They are used for high speed storage on temporary basis. They do not allow BLOB or TEXT fields.

    Heap tables do not support AUTO_INCREMENT.

    Indexes should be NOT NULL.

    Temporary tables:

    The temporary tables are used to keep the temporary data. Sometimes it is very useful in cases to keep temporary data. Temporary table is deleted after current client session terminates.

    Main differences:

    The heap tables are shared among clients while temporary tables are not shared.

    Heap tables are just another storage engine, while for temporary tables you need a special privilege (create temporary table).

  355. What Is The Difference Between Float And Double?
  356. FLOAT stores floating point numbers with accuracy up to 8 places and allocates 4 bytes, on the other hand DOUBLE stores floating point numbers with accuracy up to 18 places and allocates 8 bytes.

  357. What Are The Advantages Of Mysql In Comparison To Oracle?
  358. MySQL is a free, fast, reliable, open source relational database while Oracle is expensive, although they have provided Oracle free edition to attract MySQL users.

    MySQL uses only just under 1 MB of RAM on your laptop while Oracle 9i installation uses 128 MB.

    MySQL is great for database enabled websites while Oracle is made for enterprises.

    MySQL is portable.

  359. What Are The Disadvantages Of Mysql?
  360. MySQL is not so efficient for large scale databases.

    It does not support COMMIT and STORED PROCEDURES functions version less than 5.0.

    Transactions are not handled very efficiently.

  361. What Is The Difference Between Mysql_connect And Mysql_pconnect?
  362. Mysql_connect:

    It opens a new connection to the database.

    Every time you need to open and close database connection, depending on the request.

    Opens page every time when it loaded.

    Mysql_pconnect:

    In Mysql_pconnect, “p” stands for persistent connection so it opens the persistent connection.

    the database connection can not be closed.

    it is more useful if your site has more traffic because there is no need to open and close connection frequently and every time when page is loaded.

  363. What Does ” I_am_a_dummy Flag” Do In Mysql?
  364. The ” i_am_a_dummy flag” enables MySQL engine to refuse any UPDATE or DELETE statement to execute if the WHERE clause is not present.

  365. How To Get The Current Date In Mysql?
  366. To get current date, use the following syntax:

    SELECT CURRENT_DATE();

  367. What Are The Security Alerts While Using Mysql?
  368. Install antivirus and configure the operating system’s firewall.

    Never use the MySQL Server as the UNIX root user.

    Change root username and password

    Restrict or disable remote access.

  369. How To Change A Password For An Existing User Via Mysqladmin?
  370. Mysqladmin -u root -p password “newpassword”.

  371. What Is The Difference Between Unix Timestamps And Mysql Timestamps?
  372. Actually both Unix timestamp and MySQL timestamp are stored as 32-bit integers but MySQL timestamp is represented in readable format of YYYY-MM-DD HH:MM:SS format.

    SQL Sample Resumes! Download & Edit, Get Noticed by Top Employers!

  373. What Is Mysql Default Port Number?
  374. MySQL default port number is 3306.

  375. What Is Regexp?
  376. REGEXP is a pattern match using regular expression. Regular expression is a powerful way of specifying a pattern for a complex search.

  377. How Many Columns Can You Create For An Index?
  378. You can create maximum of 16 indexed columns for a standard table.

  379. What Is The Difference Between Now() And Current_date()?
  380. NOW() command is used to show current year, month, date with hours, minutes and seconds while CURRENT_DATE() shows the current year with month and date only.

  381. Which Command Is Used To View The Content Of The Table In Mysql?
  382. The SELECT command is used to view the content of the table in MySQL.

  383. What Is The Usage Of I-am-a-dummy Flag In Mysql?
  384. In MySQL, the i-am-a-dummy flag makes the MySQL engine to deny the UPDATE and DELETE commands unless the WHERE clause is present.

  385. What Is The Usage Of Regular Expressions In Mysql?
  386. In MySQL, regular expressions are used in queries for searching a pattern in a string.

    * Matches 0 more instances of the string preceding it.

    + matches 1 more instances of the string preceding it.

    ? Matches 0 or 1 instances of the string preceding it.

    . Matches a single character.

    [abc] matches a or b or z

    | separates strings

    ^ anchors the match from the start.

    “.” Can be used to match any single character. “|” can be used to match either of the two strings

    REGEXP can be used to match the input characters with the database.

    Example:

    The following statement retrieves all rows where column employee_name contains the text 1000 (example salary):

    Select employee_name

    From employee Where employee_name REGEXP ‘1000’ Order by employee_name

  387. How Do You Determine The Location Of Mysql Data Directory?
  388. The default location of MySQL data directory in windows is C:mysqldata or C:Program FilesMySQLMySQL Server 5.0 data.

  389. What Is Mysql Data Directory?
  390. MySQL data directory is a place where MySQL stores its data. Each subdirectory under this data dictionary represents a MySQL database. By default the information managed my MySQL = server mysqld is stored in data directory.

  391. What Is The Use Of Mysql_close()?
  392. Mysql_close() cannot be used to close the persistent connection. Though it can be used to close connection opened by mysql_connect().

  393. How Is Myisam Table Stored?
  394. MyISAM table is stored on disk in three formats.

    ‘.frm’ file : storing the table definition

    ‘.MYD’ (MYData): data file

    ‘.MYI’ (MYIndex): index file

  395. What Is The Usage Of Enums In Mysql?
  396. ENUMs are used to limit the possible values that go in the table:

    For example: CREATE TABLE months (month ENUM ‘January’, ‘February’, ‘March’); INSERT months VALUES (‘April’).

  397. What Are The Advantages Of Myisam Over Innodb?
  398. MyISAM follows a conservative approach to disk space management and stores each MyISAM table in a separate file, which can be further compresses, if required. On the other hand, InnoDB stores the tables in tablespace. Its further optimization is difficult.

  399. What Are The Differences Between Mysql_fetch_array(), Mysql_fetch_object(), Mysql_fetch_row()?
  400. Mysql_fetch_object is used to retrieve the result from the database as objects while mysql_fetch_array returns result as an array. This will allow access to the data by the field names.

    For example:

    Using mysql_fetch_object field can be accessed as $result->name.

    Using mysql_fetch_array field can be accessed as $result->[name].

    Using mysql_fetch_row($result) where $result is the result resource returned from a successful query executed using the mysql_query() function.

    Example:

    $result = mysql_query(“SELECT * from students”);

    while($row = mysql_fetch_row($result))

    {

    Some statement;

    }

  401. How Do You Backup A Database In Mysql?
  402. It is easy to backing up data with phpMyAdmin. Select the database you want to backup by clicking the database name in the left hand navigation bar. Then click the export button and make sure that all tables are highlighted that you want to backup. Then specify the option you want under export and save the output.

  403. What Is Sqlyog?
  404. SQLyog program is the most popular GUI tool for admin. It is the most popular MySQL manager and admin tool. It combines the features of MySQL administrator, phpMyadmin and others MySQL front ends and MySQL GUI tools.

  405. Define REGEXP?
  406. REGEXP is a pattern match in which matches pattern anywhere in the search value.

  407. Give string types available for column?
  408. The string types are:

    SET

    BLOB

    ENUM

    CHAR

    TEXT

    VARCHAR

  409. What storage engines are used in MySQL?
  410. Storage engines are called table types and data is stored in files using various techniques.

    Technique involves:

    Storage mechanism

    Locking levels

    Indexing

    Capabilities and functions.

  411. What are the drivers in MySQL?
  412. Following are the drivers available in MySQL:

    PHP Driver

    JDBC Driver

    ODBC Driver

    C WRAPPER

    PYTHON Driver

    PERL Driver

    RUBY Driver

    CAP11PHP Driver

    Ado.net5.mxj

  413. What does a TIMESTAMP do on UPDATE CURRENT_TIMESTAMP data type?
  414. TIMESTAMP column is updated with Zero when the table is created. UPDATE CURRENT_TIMESTAMP modifier updates the timestamp field to current time whenever there is a change in other fields of the table.

  415. What is the difference between primary key and candidate key?
  416. Every row of a table is identified uniquely by primary key. There is only one primary key for a table.

    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.

  417. How do you login to MySql using Unix shell?
  418. We can login through this command:

    # [mysql dir]/bin/mysql -h hostname -u -p

  419. What does myisamchk do?
  420. It compress the MyISAM tables, which reduces their disk or memory usage.

  421. How do you control the max size of a HEAP table?
  422. Maximum size of Heal table can be controlled by MySQL config variable called max_heap_table_size.

  423. What is the difference between MyISAM Static and MyISAM Dynamic?
  424. In MyISAM static all the fields will have fixed width. The Dynamic MyISAM table will have fields like TEXT, BLOB, etc. to accommodate the data types with various lengths.

    MyISAM Static would be easier to restore in case of corruption.

  425. What are federated tables?
  426. Federated tables which allow access to the tables located on other databases on other servers.

  427. What, if a table has one column defined as TIMESTAMP?
  428. Timestamp field gets the current timestamp whenever the row gets altered.

  429. What happens when the column is set to AUTO INCREMENT and if you reach maximum value in the table?
  430. It stops incrementing. Any further inserts are going to produce an error, since the key has been used already.

  431. How can we find out which auto increment was assigned on Last insert?
  432. LAST_INSERT_ID will return the last value assigned by Auto_increment and it is not required to specify the table name.

 

Last Updated: 2023-09-23

 

0 Comments
Leave a message

Search Current Affairs by date
Other Category List

Cookies Consent

We use cookies to enhance your browsing experience and analyze our traffic. By clicking "Accept All", you consent to our use of cookies. Cookies Policy