Results 1 to 10 of 10

Thread: How to run created table with data SQL?

  1. #1
    Hi I am new to all of this creating tables using SQL. I usally do database stuff with access. I have created this table and included some data but how do i run it so i can view the table with its data. I am using emacs on a computer that has unix btw. Here is what i typed in. Is this correct and how do i run it.

    CREATE TABLE course(
    coursecode CHAR(5) NOT NULL,
    title CHAR(25),
    school CHAR(15),
    PRIMARY KEY (coursecode));

    INSERT INTO course VALUES
    ('AB12', 'Civil Engineering', 'Engineering');
    INSERT INTO course VALUES
    ('CE65', 'Computer Science', 'Computing');

    Cheers

  2. Software & Hardware   -   #2
    to view the data you need to run a command like:

    SELECT * FROM course;
    There are 10 types of people in the world those who understand binary and those who dont

  3. Software & Hardware   -   #3
    but is the coding correctly typed in. Also when your write the coding for the tables and the data thats going to be entered when you want to update or add something does that coding need to be added in that same file. Also when making queries do you need to write the coding in same file or new new. The command you gave do i type it into the terminal?

    Cheers

  4. Software & Hardware   -   #4
    but is the coding correctly typed in.
    Yes, it looks OK
    The command you gave do i type it into the terminal?
    Yes
    There are 10 types of people in the world those who understand binary and those who dont

  5. Software & Hardware   -   #5
    I typed in SELECT * FROM course; command but all i got was an error command not found?????

  6. Software & Hardware   -   #6
    try putting the command in the file at the end
    There are 10 types of people in the world those who understand binary and those who dont

  7. Software & Hardware   -   #7
    lol now it keeps saying no match.

  8. Software & Hardware   -   #8
    I managed to get it working but doing a couple of things thanks for your help.

  9. Software & Hardware   -   #9
    4play's Avatar knob jockey
    Join Date
    Jan 2003
    Location
    London
    Age
    41
    Posts
    3,824
    normally you have to login to the mysql server first then select the database you want then you can select the data you want from it.

    sorry its been a very long time since i used it so i have forgot the commands.

  10. Software & Hardware   -   #10
    tesco's Avatar woowoo
    Join Date
    Aug 2003
    Location
    Canadia
    Posts
    21,669
    Download phpmyadmin.
    it makes running sql queries soooo much easier.
    once you have it and have configured it to connect to mysql, open it up (in web browser) and create a new database, then click on "SQL" at the top and paste that code in then submit.

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
  •