Using More Than one Table

Nasza ocena:

5
Wyświetleń: 595
Komentarze: 0
Notatek.pl

Pobierz ten dokument za darmo

Podgląd dokumentu
Using More Than one Table - strona 1

Fragment notatki:

Using More Than one Table
The pet table keeps track of which pets you have. If you want to record other information about them,
such as events in their lives like visits to the vet or when litters are born, you need another table. What
should this table look like? It needs to contain the following information:
• The pet name so that you know which animal each event pertains to.
• A date so that you know when the event occurred.
• A field to describe the event.
• An event type field, if you want to be able to categorize events.
Given these considerations, the CREATE TABLE statement for the event table might look like this:
mysql CREATE TABLE event (name VARCHAR(20), date DATE,
- type VARCHAR(15), remark VARCHAR(255));
As with the pet table, it is easiest to load the initial records by creating a tab-delimited text file
containing the following information.
... zobacz całą notatkę



Komentarze użytkowników (0)

Zaloguj się, aby dodać komentarz