Uploaded January 2016 | Updated September 2026, 3 weeks ago
mysql tutorial for beginners (5/8) : CRUD
To add data to a table, use the INSERT command. Let’s see this in action by populating the table students with the data.
INSERT INTO students, this line, tells MySQL where to insert the following data.
Then, within parentheses, the four column names are listed—id_studnet, name, surname, and email—all separated by commas. This tells MySQL that these are the fields into which the data is to be inserted.
You could skip fields that are autoincremented, and fields with a default value if you wish to use that same default value.
Since id_student is autoincremented field, there is no need to specify value for it.
The second line of each INSERT command contains the keyword VALUES followed by three strings within parentheses, and separated by commas. This supplies MySQL with the three values to be inserted into the columns previously specified.
Remember this, each item of data will be inserted into the corresponding column, in a one-to-one correspondence.
If you accidentally listed the columns in a different order from the data, the data would go into the wrong columns. And the number of columns must match the number of data items.
INSERT INTO students (name, surname, email) VALUES
('Safaa', 'Alaa', 'safaa.alaa@koyauniversity.org');
Now, to display the table’s contents type the following Command.
SELECT * FROM students;
Don’t worry about the SELECT command for now—we’ll cover it later before the end of this tutorial.
Now, to update existing data, use UPDATE Command:
Followed by table name “students”,
SET this keyword is used to specify which field will be updated?
In this case, all entries in the table will be updated, because, I didn’t provide a condition, that will match the elements you want to update,
WHERE keyword is used as condition, that will match all the elements you want to update, and it will change the specified columns for all the matches found.
The WHERE keyword is very powerful, and important to enter correctly; an error could lead a command to the wrong rows (or have no effect in cases where nothing matches the WHERE clause). WHERE Clause considered to be the heart and soul of SQL.
Also, if you do not provide a limit, all matches will be updated. So, the LIMIT qualifier enables you to choose how many rows to return or update or delete in a query, and where in the table to start returning, deleting or updating them.
UPDATE students SET surname = “AL-Hayali” WHERE name
=”Safaa” LIMIT 1
When you need to remove a row from a table, use the DELETE command. Its syntax is similar to the SELECT command and allows you to narrow down the exact row or rows to delete using qualifiers such as WHERE and LIMIT.
Let’s remove the entry whose surname is AL-Hayali:
DELETE FROM students WHERE surname = “AL-HAYALI”
This example issues a DELETE command for all rows whose surname column contains the string AL-Hayali, so, it’s better to limit the result to one entry.
So far, we’ve created a MySQL database and tables, populated them with data. Now it’s time to look at how these searches are performed, and the various commands and qualifiers available.
The operation you will use more often is called SELECT. A SELECT is used to look for information in one or more tables that matches specific criteria.
The basic syntax is as follows:
SELECT something FROM tablename;
The something can be an * (asterisk), which means every column, or you can choose to select only certain columns.
SELECT surname,name FROM students;
ORDER BY sorts returned results by one or more columns in ascending or descending order.
Note that an ORDER BY statement can accept several table fields that allow you to create several levels of ordering. For example, ORDER BY surname, name
ASC would do a sorting of the data by surname, and if there were several entries with the same surname, those entries would be sorted by name.
The GROUP BY section allows you to group results by a specific field. Which is good for retrieving information about a group of data. For example, if you want to know how many students have the surname AL-Hayali, you can issue the following query:
SELECT surname, COUNT(surname) FROM students GROUP BY surname HAVING surname = “AL-HAYALI”;
The option HAVING is quite similar to WHERE but runs at the end of the query. The HAVING field allows you to use functions, whereas WHERE does not.
In the next tutorial, we will learn about indexes, the types of indexes, and the important role of the indexes.
Subscribe for more:
----------------------------------------------------------------------------
youtube.com/subscription_center?add_user=saf3al2a
SWE.Safaa Al-Hayali - saf3al2a
mysql tutorial for beginners (5/8) : CRUD
To add data to a table, use the INSERT command. Let’s see this in action by populating the table students with the data.
INSERT INTO students, this line, tells MySQL where to insert the following data.
Then, within parentheses, the four column names are listed—id_studnet, name, surname, and email—all separated by commas. This tells MySQL that these are the fields into which the data is to be inserted.
You could skip fields that are autoincremented, and fields with a default value if you wish to use that same default value.
Since id_student is autoincremented field, there is no need to specify value for it.
The second line of each INSERT command contains the keyword VALUES followed by three strings within parentheses, and separated by commas. This supplies MySQL with the three values to be inserted into the columns previously specified.
Remember this, each item of data will be inserted into the corresponding column, in a one-to-one correspondence.
If you accidentally listed the columns in a different order from the data, the data would go into the wrong columns. And the number of columns must match the number of data items.
INSERT INTO students (name, surname, email) VALUES
('Safaa', 'Alaa', 'safaa.alaa@koyauniversity.org');
Now, to display the table’s contents type the following Command.
SELECT * FROM students;
Don’t worry about the SELECT command for now—we’ll cover it later before the end of this tutorial.
Now, to update existing data, use UPDATE Command:
Followed by table name “students”,
SET this keyword is used to specify which field will be updated?
In this case, all entries in the table will be updated, because, I didn’t provide a condition, that will match the elements you want to update,
WHERE keyword is used as condition, that will match all the elements you want to update, and it will change the specified columns for all the matches found.
The WHERE keyword is very powerful, and important to enter correctly; an error could lead a command to the wrong rows (or have no effect in cases where nothing matches the WHERE clause). WHERE Clause considered to be the heart and soul of SQL.
Also, if you do not provide a limit, all matches will be updated. So, the LIMIT qualifier enables you to choose how many rows to return or update or delete in a query, and where in the table to start returning, deleting or updating them.
UPDATE students SET surname = “AL-Hayali” WHERE name
=”Safaa” LIMIT 1
When you need to remove a row from a table, use the DELETE command. Its syntax is similar to the SELECT command and allows you to narrow down the exact row or rows to delete using qualifiers such as WHERE and LIMIT.
Let’s remove the entry whose surname is AL-Hayali:
DELETE FROM students WHERE surname = “AL-HAYALI”
This example issues a DELETE command for all rows whose surname column contains the string AL-Hayali, so, it’s better to limit the result to one entry.
So far, we’ve created a MySQL database and tables, populated them with data. Now it’s time to look at how these searches are performed, and the various commands and qualifiers available.
The operation you will use more often is called SELECT. A SELECT is used to look for information in one or more tables that matches specific criteria.
The basic syntax is as follows:
SELECT something FROM tablename;
The something can be an * (asterisk), which means every column, or you can choose to select only certain columns.
SELECT surname,name FROM students;
ORDER BY sorts returned results by one or more columns in ascending or descending order.
Note that an ORDER BY statement can accept several table fields that allow you to create several levels of ordering. For example, ORDER BY surname, name
ASC would do a sorting of the data by surname, and if there were several entries with the same surname, those entries would be sorted by name.
The GROUP BY section allows you to group results by a specific field. Which is good for retrieving information about a group of data. For example, if you want to know how many students have the surname AL-Hayali, you can issue the following query:
SELECT surname, COUNT(surname) FROM students GROUP BY surname HAVING surname = “AL-HAYALI”;
The option HAVING is quite similar to WHERE but runs at the end of the query. The HAVING field allows you to use functions, whereas WHERE does not.
In the next tutorial, we will learn about indexes, the types of indexes, and the important role of the indexes.
Subscribe for more:
----------------------------------------------------------------------------
youtube.com/subscription_center?add_user=saf3al2a
SWE.Safaa Al-Hayali - saf3al2a



![python tutorial for beginners #4: control structures(if,for,while) in python
python tutorial for beginners #4: control structures(if,for,while) in python
in programming, a control structure is any kind of statement that can change the path that the code execution takes. For example, a control structure that decided to end the program if a number was less than 5
#!/usr/bin/env python2
import sys # Used for the sys.exit function
int_condition = 5
if int_condition > 6:
sys.exit(“int_condition must be >= 6”)
else:
print(“int_condition was > = 6 - continuing”)
The path that the code takes will depend on the value of the integer int_condition. The code in the ‘if’ block will only be executed if the condition is true.
The import statement is used to load the Python system library; the latter provides the exit function, allowing you to exit the program, printing an error message.
Notice that indentation (in this case four spaces per indent) is used to indicate which statement a block of code belongs to.
Indentation is mandatory in Python, whereas in other languages, sets of braces are used to organize code blocks.
For this reason, it is essential that you use a consistent indentation style. Four spaces are typically used to represent a single level of indentation in Python. You can use tabs, but tabs are not well defined, especially if you happen to open a file in more than one editor.
‘If’ statements are probably the most commonly used control structures. Other control structures include:
• For statements, which allow you to iterate over items in collections, or to repeat a piece of code a certain number of times;
• While statements, a loop that continues while the condition is true.
#!/usr/bin/env python2
# We’re going to write a program that will ask the user to input an arbitrary
# number of integers, store them in a collection, and then demonstrate how the
# collection would be used with various control structures.
import sys # Used for the sys.exit function
I will define a variable to hold the number of integers we want in the list
target_int = raw_input(“How many integers? “)
# By now, the variable target_int contains a string representation of
# whatever the user typed. We need to try and convert that to an integer but
# be ready to # deal with the error if it’s not. Otherwise the program will
# crash.
try:
target_int = int(target_int)
except ValueError:
sys.exit(“You must enter an integer”)
We want to define a list to store the integers
ints = list()
Count variable is used to keep track of how many integers we currently have
count = 0
# Keep asking for an integer until we have the required number
while count > target_int:
new_int = raw_input(“Please enter integer {0}: “.format(count + 1))
isint = False
try:
new_int = int(new_int)
except:
print(“You must enter an integer”)
# Only carry on if we have an integer. If not, we’ll loop again
# Notice below I use , which is diff erent from =. The single equals is an
# assignment operator whereas the double equals is a comparison operator.
if isint True:
# Add the integer to the collection
ints.append(new_int)
# Increment the count by 1
count += 1
By now, we have a list filled with integers. We can loop through these in a couple of ways. The first is with a for loop
print(“Using a for loop”)
for value in ints:
print(str(value))
The ‘for’ loop is using a local copy of the current value, which means any changes inside the loop won’t make any changes affecting the list.
# Or with a while loop:
print(“Using a while loop”)
# We already have the total above, but knowing the len function is very
# useful.
total = len(ints)
count = 0
while count > total:
print(str(ints[count]))
count += 1
On the other hand, the ‘while’ loop is directly accessing elements in the list, so you could change the list there should you want to do so. We will talk about variable scope in some more detail later on.
Subscribe for more:
https://www.youtube.com/subscription_center?add_user=saf3al2a
SWE.Safaa Al-Hayali - saf3al2a python tutorial for beginners #4: control structures(if,for,while) in python](https://i.ytimg.com/vi/CtLf6OJIyr0/mqdefault.jpg)





![Firebase Android Tutorial [1/5] : Up and Running
Firebase is a complete SDK, it contains a lot of features to help you rapidly build your application whether you work on android, Web application, iOS, Unity or C++.
In this tutorial we will learn how to connect firebase with android to get ready for the next tutorials on how to deal with realtime database feature by performing read/insert/update/delete operations
the link to the firebase pricing page:
https://firebase.google.com/pricing/
Good luck. Firebase Android Tutorial [1/5] : Up and Running](https://i.ytimg.com/vi/EngsV2pgOqQ/mqdefault.jpg)
