Jump to content

What to do with sqldump.sql and a few more questions.

- - - - -

  • Please log in to reply
7 replies to this topic

#1
irfan_s

irfan_s

    Newbie

  • Members
  • PipPip
  • 25 posts
1. I "programmed" a small database in Notepad ++ and I would to put t in MySQL. What do I do with the file I called mysqldump.sql?
The MySQL server is placed on my machine and is there for educational purpouses.
I tried with mysqldump but the command wasnt reckognized nor in cmd nor in mysqlcmd...

2. How to force user to put a positive integer?
PPrice INTEGER NOT NULL I guess both negative and positive.
How to make it unsigned?

3. Is this the right way of putting data in the database?:

INSERT INTO Customer(CName, CEmail, CPhone, CCountry, CCity, CZip, CStreet) VALUES ("Johnson Doe","j.doe@edu.it",030 222 789,"Italy","Rome",75209,"Via Labicana 243a");

Thank you for your help.

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
You would use mysql -u user -p < mysqldump.sql to import the database as this would give it all of the commands. For your second question, there is an unsigned attribute, although -1 unsigned will likely be represented as some ugly integer overflow depending on your version or security, you likely will have better luck applying ABS() which will take the absolute number if that were valid, or processing the number beforehand would make a lot less work.

As for putting data in the database, that appears absolutely valid. You could encase column names with back ticks (`) to ensure there is no collision in names if that were so an issue.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
irfan_s

irfan_s

    Newbie

  • Members
  • PipPip
  • 25 posts
thank you for the fast reply.

concerning the first answer, the cmd says mysql is not reckognized as a command.

the 2rd and 3rd answers, than you, I just wanted to be sure.

#4
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
You must use the cd (change directory) command to traverse to the folder where the mysql program is contained.

You could also add the mysql binary folder to the current PATH enviornmental variable, this would allow you to call mysql from anywhere:
Quick Tip: Adding mySQL and PHP to Your Windows Path | Schwarz Network

Ensure you only add to the end, not replace existing PATH directories if you wish to add them.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#5
irfan_s

irfan_s

    Newbie

  • Members
  • PipPip
  • 25 posts
Sir, you are awesome.

Works like a charm.

Now I´ll go and punish myself for beeing a noob.

#6
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
If Windows had made it easy for programmers, then you'd have done it, do not worry!
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#7
irfan_s

irfan_s

    Newbie

  • Members
  • PipPip
  • 25 posts
MySQL Docu is very poor.

Can someone tell me what is wrong with this query

select Product where PManuf = "Apple" giving A,

join A and ProductTransaction over PNr giving B,

project B over CNr, PNr giving C,

join customer and B over CNr giving D,

project D over CName, CEmail, PName;

I keep geting the 1064 error. Thank you

#8
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
You need a from clause
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users