Interview Questions MySQL

MySQL


1. how to do login in mysql with unix shell
By below method if password is pass and user name is root
# [mysql dir]/bin/mysql -h hostname -u root -p pass

2. how you will Create a database on the mysql server with unix shell
mysql> create database databasename;

3. how to list or view all databases from the mysql server.
mysql> show databases;

4. How Switch (select or use) to a database.
mysql> use databasename;

5. How To see all the tables from a database of mysql server.
mysql> show tables;

6. How to see table's field formats or description of table .
mysql> describe tablename;

7. How to delete a database from mysql server.
mysql> drop database databasename;

8. How we get Sum of column
mysql> SELECT SUM(*) FROM [table name];

9. How to delete a table
mysql> drop table tablename;

10. How you will Show all data from a table.
mysql> SELECT * FROM tablename;