BestTechie Forums: Novice Mysql Questions - BestTechie Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Novice Mysql Questions


#1 User is offline   ineedcoffee 

  • Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 13-September 05

Posted 13 June 2010 - 02:51 PM

In college, I learned how to program in SQL using Oracle 9i running in window. Now six years later, I am trying to program in SQL using MySql running in Linux Fedora Core 11.

Even though a lot of the basic commands are the same, the way that a user connects to the SQL server and use batch files is different.

In college(Last time used was in 2004):
To log on to the server, I believe we had to edit a file to put our account in.
To run it was @c:\file_name.sql


Example Windows:
@c:\populate_database.sql;
INSERT INTO pet(name,owner,species,sex,birth,death)
VALUES ('Puffball','Diane','hamster','f','1999-03-30','NULL');

Example MySql from Tutorial
LOAD DATA LOCAL INFILE '/path/pet.txt' into TABLE pet;
Whistler Gwen bird \N 1997-12-09 \N

The linux gives an error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/home/errol/pets.txt INTO TABLE pet' at line 1

I am not sure if I missed anything, please let me know.

If anyone can suggest a good MySql book.
Thank you.

This post has been edited by ineedcoffee: 13 June 2010 - 02:52 PM


#2 User is offline   iccaros 

  • UberTechie
  • Group: Linux Experts
  • Posts: 1292
  • Joined: 31-August 04
  • Location:Great State of Washingtion
  • Operating System:Gentoo,Iccaros-Linux(of course),Slackware,GentooX,Red Hat, Windows (3.1 to VISTA BETA), MAC OSX (10.4 currently),LFS, Solaris 8,9,10, Trusted Solaris, FreeBSD, OPENBSD, NETBSD

Posted 27 June 2010 - 04:54 PM

View Postineedcoffee, on 13 June 2010 - 02:51 PM, said:

In college, I learned how to program in SQL using Oracle 9i running in window. Now six years later, I am trying to program in SQL using MySql running in Linux Fedora Core 11.

Even though a lot of the basic commands are the same, the way that a user connects to the SQL server and use batch files is different.

In college(Last time used was in 2004):
To log on to the server, I believe we had to edit a file to put our account in.
To run it was @c:\file_name.sql


Example Windows:
@c:\populate_database.sql;
INSERT INTO pet(name,owner,species,sex,birth,death)
VALUES ('Puffball','Diane','hamster','f','1999-03-30','NULL');

Example MySql from Tutorial
LOAD DATA LOCAL INFILE '/path/pet.txt' into TABLE pet;
Whistler Gwen bird \N 1997-12-09 \N

The linux gives an error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/home/errol/pets.txt INTO TABLE pet' at line 1

I am not sure if I missed anything, please let me know.

If anyone can suggest a good MySql book.
Thank you.



mysql on Linux takes the same commands as on windows.. I'm confused on why you would think its different.

mysql> Drop table Inventory;

mysql> CREATE TABLE Inventory
    -> (
    ->    ID SMALLINT NOT NULL PRIMARY KEY,
    ->    InStock SMALLINT NOT NULL,
    ->    OnOrder SMALLINT NOT NULL,
    ->    Reserved SMALLINT NOT NULL
    -> );
Query OK, 0 rows affected (0.06 sec)

mysql> INSERT INTO Inventory VALUES (101, 10, 15, 4),
    ->                              (102, 1, 9, 3),
    ->                              (103, 5, 2, 13);
Query OK, 3 rows affected (0.01 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> select * from Inventory;
+-----+---------+---------+----------+
| ID  | InStock | OnOrder | Reserved |
+-----+---------+---------+----------+
| 101 |      10 |      15 |        4 |
| 102 |       1 |       9 |        3 |
| 103 |       5 |       2 |       13 |
+-----+---------+---------+----------+
3 rows in set (0.01 sec)



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users