MySQL Basics

phpMyAdmin

We will use MySQL in the phpMyAdmin environment.

Resources

Database Terminology

A Simple Residential Database

Country Table

CountryIDPrimary LanguagePopulation
Germany1German82000000
US2English295000000
Austria3German8000000

Person Table

First NameLast Name IDCountry ID
AngelaMerkel11
WolfgangSchüssel23
GeorgeBush32
HorstKöhler41

Entity-Relationship Model (ER)

Creating Tables

CREATE TABLE country
(
  country varchar(30),
  id int(5) NOT NULL,
  primary_language varchar(30),
  population int(15),
  PRIMARY KEY (id)
);

CREATE TABLE person
(
  first_name varchar(25),
  last_name varchar(25),
  id int(5) AUTO_INCREMENT,
  country_id int(5) DEFAULT 1,
  PRIMARY KEY (id)
);

Inserting Data

Deleting Databases and Tables

One Table Queries

Join Queries

Deleting Data

Updating Data


Laboratory

Here is the link to today's assignment. If you are a Montana State student, demonstrate it during today's lab period. If you are a University of Leipzig student, either demonstrate it during today's lab period or e-mail it to Sebastian (loewe AT uni-leipzig.de) no later than the end of the day.

Valid XHTML 1.0!