SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2004
    Location
    Dublin
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Kevin Yank Paged Result Set article

    Hi,

    I'm trying to create a table called 'Jokes' from Kevin's article.

    It looks like this


    ID JokeText JokeDate AID
    1 Blah 2004 1
    2 Blah 2004 1
    3 Blah 2004 1

    The AID is a foreign key from the USER table where it is the primary key ID.

    How do I create the 'Jokes' table containing the primary key ID from the User table?

  2. #2
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is the SQL for those two tables:
    Code:
    CREATE TABLE joke (
     id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
     joketext TEXT,
     jokedate DATE NOT NULL,
     authorid INT
    );
    
    # Code to create a simple author table
    
    CREATE TABLE author (
     id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
     name VARCHAR(255),
     email VARCHAR(255)
    );
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •