| Field | Type | Null | Key | Default | Extra | |
|---|---|---|---|---|---|---|
| 0 | ID | int | NO | PRI | auto_increment | |
| 1 | Name | char(35) | NO | |||
| 2 | CountryCode | char(3) | NO | MUL | ||
| 3 | District | char(20) | NO | |||
| 4 | Population | int | NO | 0 |
| Field | Type | Null | Key | Default | Extra | |
|---|---|---|---|---|---|---|
| 0 | Code | char(3) | NO | PRI | ||
| 1 | Name | char(52) | NO | |||
| 2 | Continent | enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') | NO | Asia | ||
| 3 | Region | char(26) | NO | |||
| 4 | SurfaceArea | decimal(10,2) | NO | 0.00 | ||
| 5 | IndepYear | smallint | YES | |||
| 6 | Population | int | NO | 0 | ||
| 7 | LifeExpectancy | decimal(3,1) | YES | |||
| 8 | GNP | decimal(10,2) | YES | |||
| 9 | GNPOld | decimal(10,2) | YES | |||
| 10 | LocalName | char(45) | NO | |||
| 11 | GovernmentForm | char(45) | NO | |||
| 12 | HeadOfState | char(60) | YES | |||
| 13 | Capital | int | YES | |||
| 14 | Code2 | char(2) | NO |
| Field | Type | Null | Key | Default | Extra | |
|---|---|---|---|---|---|---|
| 0 | CountryCode | char(3) | NO | PRI | ||
| 1 | Language | char(30) | NO | PRI | ||
| 2 | IsOfficial | enum('T','F') | NO | F | ||
| 3 | Percentage | decimal(4,1) | NO | 0.0 |
PHP's 'mysqli' extension allows you to access the functionality provided by MySQL 4.1 and above.
More information about the MySQL Database server can be found at http://www.mysql.com/.
Documentation for MySQL is in the doc section of the developer subdomain: http://dev.mysql.com/doc/.
The database 'world' was created from the world database file 'world.sql', available for download from the Example Databases section of the MySQL Web site. A local text copy can be viewed here.
To create a database named 'world' from the 'world.sql' file, first open a cmd terminal in the folder containing the 'world.sql' file, then start the mysql command line client:
> mysql -u [username] -p
Execute the following SQL queries in the mysql command line app:
mysql> CREATE DATABASE world;
mysql> USE world;
mysql> SOURCE world.sql;
Note: In the database file a comment syntax unique to MySQL is employed, e.g.:
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
The "/*!40101" at the start of the line means that the following SQL statement will be executed only if the MySQL version is greater than or equal to the specified version number, 4.01.01.
Reference: Comment Syntax in the MySQL Manual.
Array
(
[0] => city
[1] => country
[2] => countrylanguage
)
Array
(
[0] => Code
[1] => Name
[2] => Continent
[3] => Region
[4] => SurfaceArea
[5] => IndepYear
[6] => Population
[7] => LifeExpectancy
[8] => GNP
[9] => GNPOld
[10] => LocalName
[11] => GovernmentForm
[12] => HeadOfState
[13] => Capital
[14] => Code2
)
Array
(
[world] => Array
(
[country] => Array
(
[0] => Array
(
[keys] => Array
(
[0] => ABW
)
[cb] => 0
)
[1] => Array
(
[keys] => Array
(
[0] => AFG
)
[cb] => 0
)
[2] => Array
(
[keys] => Array
(
[0] => AGO
)
[cb] => 0
)
[3] => Array
(
[keys] => Array
(
[0] => AIA
)
[cb] => 0
)
[4] => Array
(
[keys] => Array
(
[0] => ALB
)
[cb] => 0
)
[5] => Array
(
[keys] => Array
(
[0] => AND
)
[cb] => 0
)
[6] => Array
(
[keys] => Array
(
[0] => ANT
)
[cb] => 0
)
[7] => Array
(
[keys] => Array
(
[0] => ARE
)
[cb] => 0
)
[8] => Array
(
[keys] => Array
(
[0] => ARG
)
[cb] => 0
)
[9] => Array
(
[keys] => Array
(
[0] => ARM
)
[cb] => 0
)
[10] => Array
(
[keys] => Array
(
[0] => ASM
)
[cb] => 0
)
[11] => Array
(
[keys] => Array
(
[0] => ATA
)
[cb] => 0
)
[12] => Array
(
[keys] => Array
(
[0] => ATF
)
[cb] => 0
)
[13] => Array
(
[keys] => Array
(
[0] => ATG
)
[cb] => 0
)
[14] => Array
(
[keys] => Array
(
[0] => AUS
)
[cb] => 0
)
[15] => Array
(
[keys] => Array
(
[0] => AUT
)
[cb] => 0
)
[16] => Array
(
[keys] => Array
(
[0] => AZE
)
[cb] => 0
)
[17] => Array
(
[keys] => Array
(
[0] => BDI
)
[cb] => 0
)
[18] => Array
(
[keys] => Array
(
[0] => BEL
)
[cb] => 0
)
[19] => Array
(
[keys] => Array
(
[0] => BEN
)
[cb] => 0
)
)
)
)
Array ( )
Array
(
[sort] => Code
)
The PHP script that makes this page work was created and is copyright © 2008, 2009, 2011, 2021, 2023, 2024 by Dennis Langley, Palo Alto, California.