In this page, we will learn some basic MySQL commands used in database testing.
Connect to a database
To create a table, you must use the CREATE TABLE command and specify the table name and fields. The following command creates the department:
CREATE TABLE department (
dept_name char(20) NOT NULL,
dept_number numeric(1) NOT NULL,
mgrSSN numeric(9) NOT NULL,
mgrStartDate date NOT NULL,
PRIMARY KEY (dept_number),
Note that we have written SQL keywords in capital letters. It is a coding standard of writing an SQL query. This is to enhance the readability of the SQL query to others. SQL is NOT case sensitive.
Since you’ve created a table, you can begin inserting data to it. The
INSERT command is shown below to add a record to the table. The values must be listed in exactly the same order as the fields. Each value is separated by a comma, and all VARCHAR & CHAR data type values must be enclosed in single quotation marks.
INSERT INTO department VALUES
SELECT statement is used to retrieve data from the database. To learn about the SELECT statement:
MySQL Tutorials on this website:
For more information on MySQL Database: