Database Intro
and SQL Basic
Recap
မြဖစ် မေနသိထားသင်တ
့ ဲ့
အေြခခံ ေတွကို ြပန်ေဆွးေ းွ ကမယ်။
Contents
01 02 03
Intro to Databases CRUD
Database and tables
Database Table တည်ေဆာက်နည်းေတွကို ရှ ိ ပီ းတာ table schema ေတွကို
အမျ ိုးအစာအများ ကီးထဲကမှ ေဆွးေ းွ ကမယ်။ လိအ ု ပ် ရင်လိအ
ု ပ် သလို့
Relational database အေ ကာင်း ေြပာင်းလဲပံုေတွကိုေလ့လာ ကမယ်။
ေလ့လာမယ်။
Relational Database - ဆို တာ
● In relational database, data is stored
in tabular format
● In relational database, two or more
tables may be related to each other.
Hence the term "Relational".
● RDBMS - It is the management
system for relational database.
● Structured Query Language (SQL) is a
standard query language that is used
to work with relational databases.
Structured Query Language - SQL
We use SQL to do (CRUD)
● create databases
● create tables in a database
● read data from a table
● insert data in a table
● update data in a table
● delete data from a table
● delete database tables
● delete databases and many more
database operations
Databases and tables
databases.sql
// Create new database
CREATE DATABASE my_db;
// If there is already a database with the same name,
// SQL will throw an error while creating a database
CREATE DATABASE IF NOT EXISTS my_db;
// Show databases
SHOW DATABASES;
//Switch Databases
USE my_db;
table_creation.sql
// The SQL command creates a database named companies.
// The table contains column (field) id, name, address,
// email and phone.
CREATE TABLE IF NOT EXISTS Companies (
id int NOT NULL PRIMARY KEY,
name varchar(50),
address text,
email varchar(50),
phone varchar(10)
);
databases.sql
// delete database
DROP DATABASE my_db;
// delete the table
DROP TABLE IF EXISTS my_table;
// alter databases
ALTER TABLE Companies
ADD phone varchar(11);
// backup the database
BACKUP DATABASE my_db
TO DISK = 'my_db_backup.bak';
MySQL Data Types - Integer
MySQL Data Types - String
MySQL Data Types - Date
Thank you!
တစ် ရက်နည်းနည်းစီ တြဖည်းြဖည်း
Alex Snow School
အတူတေ
ူ လ့လာ ကစို့ ။
alexsnowschool.org/
@alexsnowschool
facebook.com/groups/alexsnowschool [email protected]
github.com/alexsnowschool