Intro To Basic SQL Commands

The Test Lead
4 min readNov 23, 2022

SQL, or Structured Query Language, is a language used in programming to manage data held in a relational database management system. To query data is to request data from a table or combination of tables. SQL has a lot of capabilities.

www.w3schools.com

There are many different versions of the SQL language, but each version must support these major commands

  • INSERT
  • SELECT
  • WHERE
  • UPDATE
  • DELETE

Today, we will go over all of these commands

INSERT

Insert is used to place new rows inside of a table. There are 2 ways to write an insert statement.

Insert adding values without specifying columns

If you are going to add values for every column in a table you simply follow the example below and do not need to specify the columns in your statement. It is important though, that you write your values in the correct order as they exist in the table based on the columns.

INSERT INTO TABLE_NAME
VALUES (value1,value2,value3,value4);

Insert adding values with specifying columns

This method allows you to create your own mapping to columns and your values. You also can only specify certain columns and SQL will only insert a row of data for those columns

INSERT INTO TABLE_NAME(column1,column2,column3, column4,...)
VALUES(value1, value2,value3,value4,...);

You would replace TABLE_NAME with the name of your table

You would replace column1 with whatever your first column is and follow that same pattern for the other columns

You would replace value1 with whatever value you would like placed in the first column and follow that same pattern for the other values

Examples

INSERT INTO TestLeadTable
VALUES ('Drake','NY',40,'ManualQA');

This will create a record that has the values Drake, NY, 40, and ManualQA

The Test Lead

SDET at fintech company in NYC. Visit personal page http://thetestinglead.com// Twitter @juss_bailey Youtube @The Test Lead