Browsed by
Category: Blog

How do you backup a database in MySQL?

How do you backup a database in MySQL?

It is easy to back 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 back up. Then specify the option you want under export and save the output.

What is InnoDB?

What is InnoDB?

InnoDB is a storage database for SQL. The ACID-transactions are also provided in InnoDB and also includes support for the foreign key. Initially owned by InnobaseOY now belongs to Oracle Corporation after it acquired the latter since 2005. InnoDB is a storage engine for MySQL databases. It provides features such as ACID (Atomicity, Consistency, Isolation, Durability) compliance, transactions, foreign key support, and row-level locking. InnoDB is the default storage engine for MySQL as of version 5.5. It is designed to…

Read More Read More

MySQL Interview Questions – Set 04

MySQL Interview Questions – Set 04

How to search second maximum(second highest) salary value(integer)from table employee (field salary)in the manner so that mysql gets less load? By below query we will get second maximum(second highest) salary value(integer)from table employee (field salary)in the manner so that mysql gets less load? SELECT DISTINCT(salary) FROM employee order by salary desc limit 1 , 1 ; (This way we will able to find out 3rd highest , 4th highest salary so on just need to change limit condtion like LIMIT…

Read More Read More

How to dump a table from a database

How to dump a table from a database

# [mysql dir]/bin/mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql To dump a table from a MySQL database, you can use the mysqldump command-line tool. Here’s the basic syntax: bash mysqldump -u [username] -p [password] [database_name] [table_name] > [output_file.sql] Replace [username] with your MySQL username, [password] with your MySQL password, [database_name] with the name of the database containing the table you want to dump, [table_name] with the name of the table you want to dump, and [output_file.sql] with the…

Read More Read More

How to delete columns in MySQL?

How to delete columns in MySQL?

We can remove, drop, or delete one or more columns in an existing table using the ALTER TABLE statement as follows: ALTER TABLE table_name DROP COLUMN column_name1, column_name2….; To delete columns in MySQL, you would typically use the ALTER TABLE statement along with the DROP COLUMN clause. Here’s the syntax: ALTER TABLE table_name DROP COLUMN column_name; Replace table_name with the name of your table and column_name with the name of the column you want to delete. Make sure to execute…

Read More Read More

How to insert Date in MySQL?

How to insert Date in MySQL?

MySQL allows us to use the INSERT STATEMENT to add the date in MySQL table. MySQL provides several data types for storing dates such as DATE, TIMESTAMP, DATETIME, and YEAR. The default format of the date in MySQL is YYYY-MM-DD. Following is the basic syntax to insert date in MySQL table: INSERT INTO table_name (column_name, column_date) VALUES (‘DATE: Manual Date’, ‘2008-7-04’); If we want to insert a date in the mm/dd/yyyy format, it is required to use the below statement:…

Read More Read More

What is the difference between MySQL_connect and MySQL_pconnect?

What is the difference between MySQL_connect and MySQL_pconnect?

Mysql_connect: It opens a new connection to the database. Every time you need to open and close the database connection, depending on the request. Opens page whenever it is loaded. Mysql_pconnect: In Mysql_pconnect, “p” stands for persistent connection, so it opens the persistent connection. The database connection cannot be closed. It is more useful if your site has more traffic because there is no need to open and close connection frequently and whenever the page is loaded.

What are the different column comparison operators in MySQL?

What are the different column comparison operators in MySQL?

The =, , <=, =, >, <>, , AND, OR or LIKE operator are the comparison operators in MySQL. These operators are generally used with SELECT statement. In MySQL, there are several column comparison operators you can use: Equal to: = Not equal to: != or <> Greater than: > Less than: < Greater than or equal to: >= Less than or equal to: <= You can use these operators to compare columns in WHERE clauses or in other expressions…

Read More Read More

What is ISAM?

What is ISAM?

It is a system for file management developed by IBM, which allows records to access sequentially or even randomly. ISAM stands for Indexed Sequential Access Method. It’s a file organization method used for managing indexes and data within databases. However, in the context of MySQL, ISAM was a storage engine used in older versions of MySQL for handling tables. It provided fast access to data but lacked some features like transactions and foreign keys. It has largely been replaced by…

Read More Read More

MySQL Interview Questions – Set 05

MySQL Interview Questions – Set 05

How will Show all records containing the name “sonia” AND the phone number ‘9876543210’ mysql> SELECT * FROM tablename WHERE name = “sonia” AND phone_number = ‘9876543210’ How to Update database permissions/privilages. mysql> flush privileges; how to Return total number of rows mysql> SELECT COUNT(*) FROM tablename; How to dump one database for backup. # [mysql dir]/bin/mysqldump -u username -ppassword –databases databasename >/tmp/databasename.sql How to delete a database from mysql server mysql> drop database databasename; How to Set a root…

Read More Read More