473,568 Members | 2,923 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 1240
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
2894
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) and type "mysql", I get this error: Can't connect to local MySQL server through socket '/home/data/mysql/mysql.sock' (13) Any idea why?...
6
2711
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 hundreds of other times. A side effect is that the connection closes. ..NET version is 1.1, same thing happens on various machines, but seems to...
0
2184
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 "LINK : fatal error LNK1000: unknown error". I notices someone has same experience as me ,...
1
1785
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 500.100 - Internal Server Error - ASP error Internet Information Services .... Technical Information (for support personnel): Error Type:
0
1551
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 System.DirectoryServices.DirectoryEntry"LDAP://mydomain.com/", "user1", "pss1", AuthenticationTypes.Secure) Dim searcher As New...
5
1943
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 server-side script, I'm getting a popup window: "Unknown error". So I'm stuck. There is no error number, so I cannot investigate it further. There are...
4
4115
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. It appears that this error occurs after I browse to the specific page and leave it for a while, then click on a linkbutton within an update panel....
3
6423
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 can't seem to track down (exact message is "MDB2 Error: unknown error"). I have an ObjectDAO class (which I'm creating via a factory) that extends...
5
2832
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 to the DEV and TST . Now most wonder thing happening is i have got one form which i enter the data into the dataGrid and i click on the "Apply"...
0
3018
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 My site didnt get loaded and was stuck by displaying this error ., so plz anyone one give me a solution.,
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7665
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.