Sample MySQL table
For my MySQL posts here is a sample MySQL table that I would be using for my examples. I would refer my posts back to this for table structure and sample data.
Table structure:
+---------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------+-------------+------+-----+---------+-------+ | name | varchar(20) | YES | | NULL | | | owner | varchar(20) | YES | | NULL | | | species | varchar(20) | YES | | NULL | | | sex | char(1) | YES | | NULL | | | birth | date | YES | | NULL | | | death | date | YES | | NULL | | +---------+-------------+------+-----+---------+-------+
Create Table SQL:
1
2
3
4
5
6
7
8
| CREATE TABLE pet ( name VARCHAR (20), owner VARCHAR (20), species VARCHAR (20), sex CHAR (1), birth DATE , death DATE ); |
Sample Data:
name | owner | species | sex | birth | death |
---|---|---|---|---|---|
Fluffy | Harold | cat | f | 1993-02-04 | |
Claws | Gwen | cat | m | 1994-03-17 | |
Buffy | Harold | dog | f | 1989-05-13 | |
Fang | Benny | dog | m | 1990-08-27 | |
Bowser | Diane | dog | m | 1979-08-31 | 1995-07-29 |
Chirpy | Gwen | bird | f | 1998-09-11 | |
Whistler | Gwen | bird | 1997-12-09 | ||
Slim | Benny | snake | m | 1996-04-29 |
Insert sample data SQL:
1
2
3
4
5
6
7
8
9
| INSERT INTO pet VALUES ( 'Fluffy' , 'Harold' , 'cat' , 'f' , '1993-02-04' , '' ), ( 'Claws' , 'Gwen' , 'cat' , 'm' , '1994-03-17' , '' ), ( 'Buffy' , 'Harold' , 'dog' , 'f' , '1989-05-13' , '' ), ( 'Fang' , 'Benny' , 'dog' , 'm' , '1990-08-27' , '' ), ( 'Bowser' , 'Diane' , 'dog' , 'm' , '1979-08-31' , '1995-07-29' ), ( 'Chirpy' , 'Gwen' , 'bird' , 'f' , '1998-09-11' , '' ), ( 'Whistler' , 'Gwen' , 'bird' , '' , '1997-12-09' , '' ), ( 'Slim' , 'Benny' , 'snake' , 'm' , '1996-04-29' , '' ) |
0 comments:
Post a Comment