how to use mysql code example

Example 1: create database in mysql

The CREATE DATABASE statement is used to create a new SQL/MySQL database.

Syntax
CREATE DATABASE databasename;

CREATE DATABASE Example
The following SQL statement creates a database called "testDB":

Example
CREATE DATABASE testDB;

Example 2: create database terminal mysql

CREATE DATABASE dbname;

Example 3: login to mysql

mysql -u USERNAME -p

Example 4: mysql go into database

USE dbname;

Example 5: mysql in

SELECT 
    column1,column2,...
FROM
    table_name
WHERE 
    column1 IN ('value1','value2',...);

Example 6: how to open database in mysql

use DBNAME;

Tags:

Sql Example