Structured Query Language: Part 2

This article describes the use of different query and operator of SQL.

Hello friends,

In my previous article you saw some Structured Query Language (SQL) commands. And now I share some more commands of SQL. If you haven't read my previous article of SQL please then read that article first because in that article I explained how to create databases and tables. Also, how to insert values into the tables and more. So please read the first article from here:

Ok, let's start.

First we show how many values we have in the database as in the following:

Select Query

The output is:

Select Query Execution

“LIKE “

Like is used when we want to search for a specific pattern. For example, we only need the person whose name starts with the letter “s” or ends with “z”. So let's see this practically.

  1. Start with specific character

    Like Operator

    The output is:

    Use of Like Operator
     
  2. Ends with specific character

    Specific Character Use

    The output is:

    Specific Character Execution
     
  3. Matched any specific pattern

    Specific Pattern Use

    The output is:

    Specific Pattern Execution

“IN” Operator

The In operator is used to select multiple values.

Use of In Operator

The output is:

In Operator Execution
“BETWEEN” Operator

The Between operator is used to select the values between a specific range.

Between Operator

The output is:

Between Operator Execution
“NOT BETWEEN” Operator

Not Between Operator Use

The output is:

Not Between Operator Execution
SQL Alias

SQL alias is used to temporarily rename the table name or column. To make an alias we use the “AS” operator as in the following:

Alias Use

The output is:

Alias Execution
Here we can see that “address” is changed to “city”.

ALTER Operator

The Alter operator is used to add, delete or modify the column.

ADD column by ALTER Operator

Alter Query

The output is:

Alter Query Execution

Now if we see the table then it looks like:

Table Structure

Here we can see that one or more columns were added to the column.

DROP column by ALTER Operator

Drop Use in Alter

The output is:

Drop Query Execution

Now if we see the table then it looks like:

New Table Structure

Here we can see that the address column is dropped from the table.

I close this article here and I think this article will help you . We will start “SQL JOINS” from the next article.