Site icon TestingDocs.com

MySQL world Database Tables

Overview

In this tutorial, we will know about the MySQL world Database Tables. The world sample database has three tables:

We can use the following

mysql> SHOW TABLES;
+—————–+
| Tables_in_world |
+—————–+
| city |
| country |
| countrylanguage |
+—————–+
3 rows in set (0.00 sec)

 

Country

Country: Database table has information about countries of the world. To know the table structure and the columns we can use the following command.

mysql> DESC Country;
+—————-+—————————————————————————————+——+—–+———+——-+
| Field | Type | Null | Key | Default | Extra |
+—————-+—————————————————————————————+——+—–+———+——-+
| Code | char(3) | NO | PRI | | |
| Name | char(52) | NO | | | |
| Continent | enum(‘Asia’,’Europe’,’North America’,’Africa’,’Oceania’,’Antarctica’,’South America’) | NO | | Asia | |
| Region | char(26) | NO | | | |
| SurfaceArea | decimal(10,2) | NO | | 0.00 | |
| IndepYear | smallint | YES | | NULL | |
| Population | int | NO | | 0 | |
| LifeExpectancy | decimal(3,1) | YES | | NULL | |
| GNP | decimal(10,2) | YES | | NULL | |
| GNPOld | decimal(10,2) | YES | | NULL | |
| LocalName | char(45) | NO | | | |
| GovernmentForm | char(45) | NO | | | |
| HeadOfState | char(60) | YES | | NULL | |
| Capital | int | YES | | NULL | |
| Code2 | char(2) | NO | | | |
+—————-+—————————————————————————————+——+—–+———+——-+
15 rows in set (0.00 sec)

City

City: Table has information about some cities in those countries.

mysql> DESC City;
+————-+———-+——+—–+———+—————-+
| Field | Type | Null | Key | Default | Extra |
+————-+———-+——+—–+———+—————-+
| ID | int | NO | PRI | NULL | auto_increment |
| Name | char(35) | NO | | | |
| CountryCode | char(3) | NO | MUL | | |
| District | char(20) | NO | | | |
| Population | int | NO | | 0 | |
+————-+———-+——+—–+———+—————-+
5 rows in set (0.02 sec)

 

Countrylanguage

Countrylanguage: Database table with languages spoken in each country.

mysql> DESC CountryLanguage;
+————-+—————+——+—–+———+——-+
| Field | Type | Null | Key | Default | Extra |
+————-+—————+——+—–+———+——-+
| CountryCode | char(3) | NO | PRI | | |
| Language | char(30) | NO | PRI | | |
| IsOfficial | enum(‘T’,’F’) | NO | | F | |
| Percentage | decimal(4,1) | NO | | 0.0 | |
+————-+—————+——+—–+———+——-+
4 rows in set (0.00 sec)

 

 

MySQL Tutorials

MySQL Tutorials on this website:

https://www.testingdocs.com/mysql-tutorials-for-beginners/

For more information on MySQL Database:

https://www.mysql.com/

Exit mobile version