Sinisterly
Tutorial What is SQL?? - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Coding (https://sinister.li/Forum-Coding--71)
+--- Thread: Tutorial What is SQL?? (/Thread-Tutorial-What-is-SQL)

Pages: 1 2


What is SQL?? - Mr.Kurd - 03-23-2019

In The Name OF Allah
Al-Salam Alekum

[Image: p_1176u1cyt1.png]

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. Biggrin

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 Biggrin . 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: Confusedmoker: . 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.

[Image: p_11761m2u92.png]

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

Code:
SELECT * FROM `users`

I got everything:
[Image: p_117671ygy3.png]

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


[Image: p_1176pvnmn4.png]

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`
[Image: p_1176onc065.png]

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:
[Image: p_1176ppo0l6.png]

Another example getting the Row by users name:

Code:
SELECT * FROM users WHERE `Name`='virus'
[Image: p_11767el1j7.png]

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.

Wa Salam Alekum Heart



RE: What is SQL?? - mothered - 03-23-2019

Very well presented guide.

Do remember that backticks are not necessary when querying single column/table names, but "must" be Included with two or more separate words, otherwise a syntax error will be experienced. Also, when using the CLI, a semicolon must be added at the end of each query.


RE: What is SQL?? - Mr.Kurd - 03-23-2019

(03-23-2019, 08:16 AM)mothered Wrote: Very well presented guide.

Do remember that backticks are not necessary when querying single column/table names, but "must" be Included with two or more separate words, otherwise a syntax error will be experienced. Also, when using the CLI, a semicolon must be added at the end of each query.

Thank you mothered for improving the thread content. Smile


RE: What is SQL?? - mothered - 03-23-2019

(03-23-2019, 10:34 AM)Mr.Kurd Wrote:
(03-23-2019, 08:16 AM)mothered Wrote: Very well presented guide.

Do remember that backticks are not necessary when querying single column/table names, but "must" be Included with two or more separate words, otherwise a syntax error will be experienced. Also, when using the CLI, a semicolon must be added at the end of each query.

Thank you mothered for improving the thread content. Smile

You're very welcome.

There's absolutely nothing wrong with using backticks on single words- I often do It with the database Itself, tables & column names. I was just making a point that It's not necessary. Of course, values must be enclosed In (single) quotes.
Thanks again for a HQ tutorial.


RE: What is SQL?? - darkninja1980 - 03-24-2019

nice and simple guide for SQL Smile


RE: What is SQL?? - mothered - 03-30-2019

This Is an excellent starting point for those wishing to get Into SQL.

There's a lot to consider and In my experience, It'll take around a year to become proficient.


RE: What is SQL?? - zorrophreak - 03-31-2019

Thank you a ton for this guide on SQL. Its nice to see you on the forum especially giving out good guides and good data. Thanks a lot for the share!


RE: What is SQL?? - mothered - 03-31-2019

(03-31-2019, 03:19 AM)zorrophreak Wrote: Thank you a ton for this guide on SQL. Its nice to see you on the forum especially giving out good guides and good data. Thanks a lot for the share!

His guides are very HQ.

Looking at the contents of this, It would've taken quite a while to complete.


RE: What is SQL?? - Mr.Kurd - 03-31-2019

(03-24-2019, 12:23 AM)darkninja1980 Wrote: nice and simple guide for SQL Smile

Welcome bro ❤


RE: What is SQL?? - Mr.Kurd - 03-31-2019

(03-31-2019, 03:19 AM)zorrophreak Wrote: Thank you a ton for this guide on SQL. Its nice to see you on the forum especially giving out good guides and good data. Thanks a lot for the share!

Thank you for your kind words appreciate them. I will try writing more In Sha Allah if time and my study helps me.