Showing posts with label MySQL-Interview-Questions. Show all posts
Showing posts with label MySQL-Interview-Questions. Show all posts

Relational Databases-MySQL

MySQL is a relational database. An important feature of relational systems is that a single database can be spread across several tables as opposed to our flat-file phone book example. Related data is stored in separate tables and allows you to put them together by using a key common to both tables. The key is the relation between the tables. The selection of a primary key is one of the most critical decisions you'll make in designing a...

Use mysqldump to create a copy of the database?

mysqldump -h mysqlhost -u username -p mydatabasename > tgdbdump.s...

What is SERIAL data type in MySQL?

BIGINT NOT NULL PRIMARY KEY AUTO_INCREME...

What’s the default port for MySQL Server?

33...

Data Control Language (DCL) statements ?

Data Control Language (DCL) statements  Allow you to change the permissions on database structures. There are two DCL statements: GRANT  Allows you to give another user access to your database structures, such as tables. REVOKE  Allows you to prevent another user from accessing to your database structures, such as tables. ...

Data Definition Language (DDL) statements?

Data Definition Language (DDL) statements  Allow you to define the data structures, such as tables, that make up a database. There are five basic types of DDL statements: CREATE  Allows you to create a database structure. For example, CREATE TABLE is used to create a table; another example is CREATE USER, which is used to create a database user. ALTER  Allows you to modify a database structure. For example, ALTER TABLE is used to modify a table. DROP  Allows you to remove a database...

Data Manipulation Language (DML) statements ?

Data Manipulation Language (DML) statements  Allow you to modify the contents of tables. There are three DML statements: INSERT  Allows you to add rows to a table. UPDATE  Allows you to change a row. DELETE  Allows you to remove rows. ...

What Is a Relational Database?

The basic concepts of a relational database are fairly easy to understand. A relational database is a collection of related information that has been organized into structures known as tables. Each table contains rows that are further organized into columns. These tables are stored in the database in structures known as schemas, which are areas where database users may store their tables. Each user may also choose to grant permissions to other users to access their tables...

MySQL Subqueries?

You can use the result of a query like you use a list of values with the IN operator to filter a query based on the result of another query. The subquery appears in parentheses after the IN keyword. The following query fetches all columns from the products table, but only for those product codes that were part of order number 1: mysql> SELECT * -> FROM products -> WHERE product_code IN ( -> SELECT product_code -> FROM order_lines -> WHERE order_id = 1 -> ); +--------------+---------------+--------+--------+ |...

what is Triggers?

A trigger is a stored database object that contains a series of SQL commands, set to activate automatically when certain events take place. Each trigger is associated with a table. You can create a trigger that will fire when an INSERT, UPDATE, or DELETE takes place on the named table...

What Is SQL?

The Structured Query Language (SQL) is the most common way to retrieve and manage database information. An SQL query consists of a series of keywords that define the data set you want to fetch from the database. SQL uses descriptive English keywords, so most queries are easy to understand...

Restore database (or database table) from backup?

 [mysql dir]/bin/mysql -u username -ppassword databasename < /tmp/databasename.sql...

How set a root password if there is on root password?

# mysqladmin -u root password newpassword...

total number of rows?

mysql> SELECT COUNT(*) FROM table;...

Show unique records mysql?

mysql> SELECT DISTINCT column FROM table;...

CSV tables?

CSV tables are the special tables, data for which is saved into comma-separated values files  and cannot be indexe...

MySQL data directory?

MySQL data directory is most important location in which all  MySQL databases are stored. The default data directory is located in the file mysql.lf. ...

difference between mysql_connect and mysql_pconnect?

Mysql_connect:  Opens a new connection to the database  The database connection can be closed  Opens the page every time the page is loaded. Mysql_pconnect:  Opens a persistent connection to the database. The database connection can not be closed. The page need not be opened every time the page is loaded...