Introduction to MYSQL with simple explanation. MYSQL is one of the most popular variants of database and it has been widely used with many open source software. This slide will serve as a kick start guide to newcomers on what database is and explain common usage of database.
3. Relate SQL like a smart Excel or Access
•Speed, speed and more speed.
•No programming language out there can outperform SQL when it comes
to bulk operations.
•Data integrity
•SQL has many tools to help make sure the data stored conforms to rules
designed by the system architects.
•Availability & scalability
•allows multiple users to work on the same dataset
Advantage of SQL
4. In SQL Language:
SELECT *
FROM Book
WHERE price > 100.00
ORDER BY title;
A quick look at it
In Human Language:
I want a list all of books in the order of alphabetical
order according to title where the price is more than
100.
5. CHECKLIST – Before We Start
• MYSQL 5.5 Command Line Client
• Type every command
• MYSQL Workbench CE
• Graphical User Interface(GUI)
• Make sure you have this two installed
12. CREATINGTABLES
NOTE : When you create a ‘TABLE’, you need to create AT LEAST ONE
column.
Mysql>CREATE TABLE `newtable` ( `firstcolumn` VARCHAR(20) NOT
NULL, PRIMARY KEY (`firstcolumn`));
HUMAN LANGUAGE:
Hey, Create a table call ‘newtable’ and create a column named
‘firstcolumn’ that can fit 20 character and must not be empty which is
also a primary key.
13. INSERTINGVALUES
Try type the same thing again. What happened?
INSERT INTO `newtable` (`firstcolumn`) VALUES ('1111');
HUMAN LANGUAGE:
Hey, please insert the value ‘1111’ into the ‘firstcolumn’ or the table
‘newtable’
14. KEYTERMS
Primary Key : ONLY UNIQUE VALUE, NO REPEAT VALUE
VARCHAR : Variable-length character
VARCHAR(10) : Variable-length character, Max 10 character
INT : Integer only
….Many More, however for this level lets just fixed a few.
NOT NULL : Cannot store empty value
15. EXERCISE
CREATE a database ‘exercisedb’
CREATE a table ‘exercisetable’
CREATE a varchar(20) column ‘firstcolumn’ and make it a primary
key.
INSERT any value into column ‘firstcolumn’ [10 times]
INSERT INTO `newtable` (`firstcolumn`) VALUES ('1111');
Mysql>CREATE TABLE `newtable` ( `firstcolumn` VARCHAR(20) NOT
NULL, PRIMARY KEY (`firstcolumn`));
Cheat Sheet
17. COMMANDLINE - LIMITATION
If the exercise challenge change to this question.
What do you think?
INSERT any value into column ‘firstcolumn’ [300 times]