Structured Query Language: Part 2

Introduction

You saw some Structured Query Language (SQL) commands in my previous article. And now, I share some more commands of SQL. If you haven't read my previous article on 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. 

Before reading this article, I will suggest you all go through my previous article-

Ok, let's start.

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

Select Query

Output

Select Query Execution

"LIKE "

Like is used when searching 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 practice.

Start with a specific character.

Like Operator

Output

Use of Like Operator

It ends with a specific character

Specific Character Use

Output

Specific Character Execution 

Matched any specific pattern

Specific Pattern Use

Output 

Specific Pattern Execution

"IN" Operator

The In operator is used to select multiple values.

Use of In Operator

Output

In Operator Execution

"BETWEEN" Operator

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

Between Operator

Output

Between Operator Execution

"NOT BETWEEN" Operator

Not Between Operator Use

Output

Not Between Operator Execution

SQL Alias

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

Alias Use

Output

Alias Execution

Here we 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

Output

Alter Query Execution

Now if we see the table, then it looks like this:

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

Output

Drop Query Execution

Now if we see the table, then it looks like this.

New Table Structure

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

Summary

I close this article here, and I think this article will help you. We will start "SQL JOINS" in the next article.

Reference


Similar Articles