Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS311 Database Management system

Similar presentations


Presentation on theme: "CS311 Database Management system"— Presentation transcript:

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

6

7

8

9

10

11 Press Enter

12

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.

17

18

19

20

21

22

23

24

25

26

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.


Download ppt "CS311 Database Management system"

Similar presentations


Ads by Google