473,503 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

unknown error and filling data in MySQL

56 New Member
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE `norm`.`sphone` (
  2.   `sid` INT NOT NULL,
  3.   `phone` VARCHAR(45) NOT NULL,
  4.   PRIMARY KEY (`sid`, `phone`),
  5.   CONSTRAINT `sid`
  6.     FOREIGN KEY ()
  7.     REFERENCES `norm`.`staff` ()
  8.     ON DELETE RESTRICT
  9.     ON UPDATE RESTRICT);
i am new with MySQL , and when this code is executed, it gives me this error
ERROR 1064: 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 ')

REFERENCES `norm`.`staff` ()

ON DELETE RESTRICT

ON UPDATE RESTRICT' at line 6

SQL Statement:

CREATE TABLE `norm`.`sphone` (

`sid` INT NOT NULL,

`phone` VARCHAR(45) NOT NULL,

PRIMARY KEY (`sid`, `phone`),

CONSTRAINT `sid`

FOREIGN KEY ()

REFERENCES `norm`.`staff` ()

ON DELETE RESTRICT

ON UPDATE RESTRICT)

i can not understand the error and don't know how to solve it?
also, would anyone tell me how to fill the tables with data?
Jan 24 '14 #1
6 1233
Rabbit
12,516 Recognized Expert Moderator MVP
Your foreign key syntax is wrong. You didn't tell it which fields the foreign key is on.
Jan 24 '14 #2
Norgy
56 New Member
could you explain more please :$
Jan 24 '14 #3
Rabbit
12,516 Recognized Expert Moderator MVP
A foreign key links a field in one table to another field in another table. You didn't specify those fields.

The syntax is:
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE someTable
  2.  (
  3.  field definitions,
  4.  FOREIGN KEY (field in this table) REFERENCES otherTable(field in other table)
  5.  )
Jan 24 '14 #4
Norgy
56 New Member
solved, thanks a lot :)
now, i don't know how to fill the tables with data?
Jan 24 '14 #5
Rabbit
12,516 Recognized Expert Moderator MVP
We limit the threads to one question per. Please create a new thread for your new question.

As a side note, inserting data is one of the basic SQL tasks, you should probably read a tutorial.
Jan 24 '14 #6
Norgy
56 New Member
ok, thank you very much :)
Jan 24 '14 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2887
by: Brett B | last post by:
I just installed mysql on linux. If I open a terminal, su to root, then type "mysql", I am able to connect to the server and run my queries. If I exit out of su so that I am my own id (baisley)...
6
2708
by: quilkin | last post by:
I am getting a System.Data.SqlClient.SqlException with a message string of 'Unknown Error'. Happens occasionally when creating a "new SqlCommand(...)" while the same command works perfectly happily...
0
2174
by: Davis Ming | last post by:
Hi All, I used Microsoft Liner (7.00.9210) with makefile to compile an existing project. It works well until I add "/PDBSTRIPPED" option in order to get public symbol files. The error message is...
1
1779
by: Dmitry Davletbaev | last post by:
Hi! I have an ASP page with script in it. This script makes connection to Access database (JET 4.0) and retrieves data. Some time later this page became unavailable with following error: HTTP...
0
1538
by: multisync | last post by:
I'm getting the following error: Unknown error (0x80005000) It gives this error on the line "results = searcher.FindAll()" -----code------ Dim rootentry As New...
5
1938
by: Peter Afonin | last post by:
Hello, I'm developing an Atlas application in ASP.NET 2.0. Everything was OK, but suddenly I started to get some strange errors on one of the pages: When I click any button or invoke any...
4
4111
by: Jeremy | last post by:
I am getting an error Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occured while processing the request on the server. The status code returned from the server was:500. ...
3
6406
by: Rob Wilkerson | last post by:
Hey all - I'm bumping into an issue with my installation of the MDB2 package that I'm hoping someone else has seen. I'm trying to execute a query, but get an "unknown error" exception that I...
5
2826
by: HKN | last post by:
Hi , i have created one AJAX enable sites ASP.NET for my client. it is working fine on my local machine . basically , i have got three servers ( DEV,TST,PRD) i have copied all the source code...
0
3013
by: vjayis | last post by:
Hi i got an error while my site gets loaded Warning: mysql_query() : Unable to save result set in /path../includes/mysql.class.php on line 39 Error in Selection MySQL client ran out of memory...
0
7083
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7456
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1510
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.