MySQL - Operation

Create database:

CREATE DATABASE db;

Drop database:

DROP DATABASE db;

Select table and export to CSV file:

select * from table where id in (78,
80,
81,
152,
837) into outfile '/var/lib/mysql-files/output.csv' fields terminated by ',' enclosed by '"' lines terminated by '\n';

Create a table:

CREATE TABLE table
(
id int(11),
name varchar(80)
);

Insert table:

INSERT INTO tutorials_tbl
(tutorial_title, tutorial_author, submission_date)
VALUES
("JAVA Tutorial", "Sanjay", '2007-05-06'),
("JAVA Tutorial", "Sanjay", '2007-05-06');

Modify table:

ALTER TABLE contacts ADD email VARCHAR(60);
ALTER TABLE contacts ADD email VARCHAR(60) AFTER name;
ALTER TABLE contacts ADD email VARCHAR(60) FIRST;
ALTER TABLE position ADD PRIMARY KEY (staffid);

Update table:

UPDATE hs_hr_users SET user_password='xxx' WHERE id=USR001;

Delete a table:

DELETE FROM table where id = '1';