Download presentation
Presentation is loading. Please wait.
1
CS311 Database Management system
Lecture 6 CS311 Database Management system Somchai Thangsathityangkul
2
SQL IBM Sequel language developed as part of System R project at the IBM San Jose Research Laboratory Renamed Structured Query Language (SQL) Language for database definition, manipulation, and control International standard Oracle SQL Server DB2 mySQL
3
What do we need for mySQL ?
Wamp : After we install wampserver, we will have apache , php , MySQL in our PC.
4
Install wamp server
5
Type directory to install
11
Press Enter
13
Create new database Now , we can create any new database for our project. Create database databasename; Suppose we want to create cs311 db. Type command : Create database cs311; Type command : Show databases ; this will show all databases we have Type command : use cs311 ; this will change current database to cs311
14
Command to show all Databases. Default Databases.
15
Command to create a Database. Database name cs311 .
16
Must select database first.
Database name does not exist. Select database that we need.
27
Create Table Create Table table_name ( column_name data type , ………. ,
constraints ….. ) ;
28
Create table mytable ( my_id int auto_increment primary key , my_fname varchar(20) not null, my_address tinytext , my_birthday date ) ;
29
Create table my_friend (
friend_id int auto_increment primary key, friend_fn varchar(20) not null, my_id int not null, foreign key ( my_id ) references mytable ( my_id ) );
30
Show all tables in database Table mytable after created
31
There are two tables here. Only one table left after drop table.
Drop table command Drop table is a command to delete a table that we do not use it anymore. Lets try to drop parent table by type command : drop table parent ; There are two tables here. Only one table left after drop table.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.