Discord Server Twitter Donation Youtube
Windscribe
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tutorial What is SQL??
#1
In The Name OF Allah
Al-Salam Alekum

   

Hello guys, I came back to you with a new tutorial, I will try to explain SQL for you. What is SQL and its benefit. Big Grin

What is SQL??
SQL stand for Structured Query Language is a set of instruction used to communicate with Database. When you are using a program which is using Database for storing data, you are giving instruction by clicking on buttons like (Add, Delete, Insert, Search ...etc). by itself the program translates your commands into a SQL statement that the database knows how to interpret.

What is Data??
Data is a set of values for qualitative or quantitative variables. It can be character, a word or a statement. For example (My username here on the forum @Mr.Kurd is Data).

What is Database??
A database is an organized collection of data, stored and accessed, it makes collecting easy and has ability for manipulation and updating.

Okay, I think you have an idea now what are we talking about Big Grin . mhm We will face another term Database Management System (DBMS).

What is Database Management System (DBMS)
DBMS is a collection of programs for managing data and simultaneously it support different types of users to create, manage, retrieve, update and store information. The most common type of DBMS is Relational database management systems (RDBMS’s).

What is our new boy  Dodgy  RDBMS??
A relational database management system (RDBMS) is a program that allows you to create, update, and administer a relational database. Most relational database management systems use the SQL language to access the database. yey we used SQL word again for second time.

I think we have to talk about another term here? Which one? mhm you took a lot of time. Don't worry am telling you now  Tongue  it is relational database

What is RDB(Relational Database)??
RDB is a type of Databases, In simplest terms, a relational database is one that presents information in tables with rows and columns.

Well we are good to go now Dodgy  Aren't we? Wink

Popular Relational DBMS
  1. SQL Server
  2. MySQL
  3. Oracle
  4. PostgreSQL
  5. IBM Db2
 
Why we need to talk about these terms? We really wouldn't need it if you knew that before Punsh  Smoker . SQL is the standard language for dealing with Relational Databases and gives you or has ability to insert, search, update, delete database records.

Let's focus on SQL now. There is a set of basic SQL commands that is considered standard and is used by all RDBMSs. all of them are using SELECTE  statement. Example of SQL statements and RDB database:

We have a table consist of 4 Columns and 3 Rows shown below:

PHP Code:
Num. | Name         Age  Sex
  1  
Kurdy        |  40  Male 
  2  
Miss4ulove  |  22  Female
  3  
Virus        |  32  Male 

SELECT statement used to get information from the Database. Am gonna make a test Database on my Local MySQL server and with help of phpmyadmin is a free and open source administration tool for MySQL and MariaDB.

   

First example for SELECT statement is getting whole data from our database inside the users table:

Code:
SELECT * FROM `users`

I got everything:
   

Second getting just the Name column of users:
Code:
SELECT `Name` FROM `users`


   
 
If you want to get all column we will use just a * symbol for selecting all columns but if you want select one of them you are gonna write down the name of the column the example above we got all data which below to Name column. We can select more than one column this way:
Code:
SELECT `Num.`,`Name` FROM `users`
     

Let us get one row this time. We are having three Rows we will chose first Row Number one.

Code:
SELECT * FROM users WHERE `Num.`=1
In this example we got the row which Num. equals to 1:
   

Another example getting the Row by users name:

Code:
SELECT * FROM users WHERE `Name`='virus'
   

I think I gave you the idea, I will try explain some of other SQL statements in my next tutorial Wink
Finally if you have any question feel free asking and am sorry for any grammatically errors Dodgy   

Wa Salam Alekum Heart
Idea
* This is My Home *
Kurdy
Reply




Users browsing this thread: 1 Guest(s)