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:

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:

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','')
I have taken this table structure and data from MySQL documentation (Creating a table and Loading Data into Table).

Related posts:

  1. MySQL ordering results by specific field values
  2. How to get size of BLOB in MySQL
  3. What does int(11) means in MySQL?
  4. How to Find and Replace Data in MySQL

Leave a Reply