TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

MySQL

Basic MySQL Commands

Overview

In this page, we will learn some basic MySQL commands used in database testing.

Connect to a database

https://www.testingdocs.com/working-with-mysql-command-line/

Create Table

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),
UNIQUE (dept_name)
);

 

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.

DESCRIBE statement

https://www.testingdocs.com/mysql-describe-statement/

INSERT

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 
(‘Quality Assurance’,1,111223333,’1994-05-24′);

 

SELECT statement

SELECT statement is used to retrieve data from the database. To learn about the SELECT statement:

https://www.testingdocs.com/mysql-select-statement/

—

MySQL Tutorials

MySQL Tutorials on this website:

https://www.testingdocs.com/mysql-tutorials-for-beginners/

For more information on MySQL Database:

https://www.mysql.com/

Related Posts

DataGrip Desktop Shortcut

MySQL /

Launch DataGrip on Windows

DataGrip Download

MySQL /

Install DataGrip IDE on Windows 11

MySQL Workbench Windows 11

MySQL /

New MySQL Connection in Workbench

MySQL Command-line Client

MySQL /

Command-Line MySQL Client

Start MySQL Client

MySQL /

Start MySQL Client on Windows 11

‹ LAMP Stack Components› Create a Table in MySQL Database

Recent Posts

  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version