Browsed by
Tag: Top Interview Questions on MySQL

What is the difference between UNIX timestamps and MySQL timestamps?

What is the difference between UNIX timestamps and MySQL timestamps?

Actually, both Unix timestamp and MySQL timestamp are stored as 32-bit integers, but MySQL timestamp is represented in the readable format of YYYY-MM-DD HH:MM:SS format. UNIX timestamps and MySQL timestamps are both used to represent points in time, but they differ in their formats and usage: UNIX Timestamps: UNIX timestamps, also known as epoch time or POSIX time, represent the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC. They are represented as a single integer value,…

Read More Read More

How is the MyISAM table stored?

How is the MyISAM table stored?

MyISAM table is stored on disk in three formats. ‘.frm’ file : storing the table definition ‘.MYD’ (MYData): data file ‘.MYI’ (MYIndex): index file MyISAM tables in MySQL are stored as three types of files on the disk: .frm file: This file stores the table definition. .MYD file: This file contains the data. .MYI file: This file holds the index data. Each of these files is crucial for the functioning of a MyISAM table.

What are DDL, DML, and DCL?

What are DDL, DML, and DCL?

Majorly SQL commands can be divided into three categories, i.e., DDL, DML & DCL. Data Definition Language (DDL) deals with all the database schemas, and it defines how the data should reside in the database. Commands like CreateTABLE and ALTER TABLE are part of DDL. Data Manipulative Language (DML) deals with operations and manipulations on the data. The commands in DML are Insert, Select, etc. Data Control Languages (DCL) are related to the Grant and permissions. In short, the authorization…

Read More Read More

MySQL Interview Questions – Set 13

MySQL Interview Questions – Set 13

How to join three tables in MySQL? Sometimes we need to fetch data from three or more tables. There are two types available to do these types of joins. Suppose we have three tables named Student, Marks, and Details. Let’s say Student has (stud_id, name) columns, Marks has (school_id, stud_id, scores) columns, and Details has (school_id, address, email) columns. 1. Using SQL Join Clause This approach is similar to the way we join two tables. The following query returns result…

Read More Read More

Why do we use the MySQL database server?

Why do we use the MySQL database server?

First of all, the MYSQL server is free to use for developers and small enterprises. MySQL server is open source. MySQL’s community is tremendous and supportive; hence any help regarding MySQL is resolved as soon as possible. MySQL has very stable versions available, as MySQL has been in the market for a long time. All bugs arising in the previous builds have been continuously removed, and a very stable version is provided after every update. The MySQL database server is…

Read More Read More

What is MySQL Workbench?

What is MySQL Workbench?

MySQL Workbench is a unified visual database designing or GUI tool used for working on MySQL databases. It is developed and maintained by Oracle that provides SQL development, data migration, and comprehensive administration tools for server configuration, user administration, backup, etc. We can use this Server Administration to create new physical data models, E-R diagrams, and SQL development. It is available for all major operating systems. MySQL provides supports for it from MySQL Server version v5.6 and higher. It is…

Read More Read More

What is the difference between TRUNCATE and DELETE in MySQL?

What is the difference between TRUNCATE and DELETE in MySQL?

TRUNCATE is a DDL command, and DELETE is a DML command. It is not possible to use Where command with TRUNCATE QLbut you can use it with DELETE command. TRUNCATE cannot be used with indexed views, whereas DELETE can be used with indexed views. The DELETE command is used to delete data from a table. It only deletes the rows of data from the table while truncate is a very dangerous command and should be used carefully because it deletes…

Read More Read More

How to display the nth highest salary from a table in a MySQL query?

How to display the nth highest salary from a table in a MySQL query?

Let us take a table named the employee. To find Nth highest salary is: select distinct(salary)from employee order by salary desc limit n-1,1 if you want to find 3rd largest salary: select distinct(salary)from employee order by salary desc limit 2,1 To display the nth highest salary from a table in MySQL, you can use the following query: SELECT salary FROM employees ORDER BY salary DESC LIMIT n-1, 1; Replace employees with the name of your table and salary with the…

Read More Read More

What is the usage of ENUMs in MySQL?

What is the usage of ENUMs in MySQL?

ENUMs are string objects. By defining ENUMs, we allow the end-user to give correct input as in case the user provides an input that is not part of the ENUM defined data, then the query won’t execute, and an error message will be displayed which says “The wrong Query”. For instance, suppose we want to take the gender of the user as an input, so we specify ENUM(‘male’, ‘female’, ‘other’), and hence whenever the user tries to input any string…

Read More Read More

MySQL Interview Questions

MySQL Interview Questions

MySQL Interview Questions – Set 14 MySQL Interview Questions – Set 13 MySQL Interview Questions – Set 12 MySQL Interview Questions – Set 11 MySQL Interview Questions – Set 10 MySQL Interview Questions – Set 09 MySQL Interview Questions – Set 08 MySQL Interview Questions – Set 07 MySQL Interview Questions – Set 06 MySQL Interview Questions – Set 05 MySQL Interview Questions – Set 04 MySQL Interview Questions – Set 03 MySQL Interview Questions – Set 02 MySQL Interview…

Read More Read More