473,608 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to create MUL keys in mysql

14 New Member
Helo,

I have problem in finding right tutorial how to create multi key in DB.
I have 4 tables. in each I have
TIME datatime
Nr int
I want them as a MUL key, could You help me in creating the right code to create such a tables.The code has a bug in sql syntax, can You see
Expand|Select|Wrap|Line Numbers
  1.  CREATE TABLE table1 (
  2.   value int(11) NOT NULL default '0',
  3.   time datetime NOT NULL default '0000-00-00 00:00:00',
  4.   nr int(10) unsigned NOT NULL default '0',
  5.   KEY `time` (`time`),
  6.   KEY `node` (`node_nr`)
  7. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
  8.  
I am not sure about apostrophs..
I would be very grateful for help,Thanks!
Dec 8 '07 #1
5 13321
Megi
14 New Member
sorry, here is the code I have:

Expand|Select|Wrap|Line Numbers
  1.       CREATE TABLE table1 (
  2.         value int(11) NOT NULL DEFAULT '0',
  3.         time datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  4.         nr int(10) UNSIGNED NOT NULL DEFAULT '0',
  5.         KEY `time` (`time`),
  6.         KEY `node` (`nr`)
  7.       ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
  8.  
it does not work ...mayby any idea..thanks
Dec 8 '07 #2
amitpatel66
2,367 Recognized Expert Top Contributor
sorry, here is the code I have:

Expand|Select|Wrap|Line Numbers
  1.       CREATE TABLE table1 (
  2.         value int(11) NOT NULL DEFAULT '0',
  3.         time datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  4.         nr int(10) UNSIGNED NOT NULL DEFAULT '0',
  5.         KEY `time` (`time`),
  6.         KEY `node` (`nr`)
  7.       ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
  8.  
it does not work ...mayby any idea..thanks
Please POST your error here for reference?
Dec 8 '07 #3
Megi
14 New Member
Hi,

I have deleted the apostrophs from code, but the error still is.
Expand|Select|Wrap|Line Numbers
  1. mysql> CREATE TABLE smoke (
  2.     ->   smoke varchar(5) NOT NULL default '0',
  3.     ->   time datetime NOT NULL default '0000-00-00 00:00:00',
  4.     ->   node_nr int(10) unsigned NOT NULL default '0',
  5.     ->   KEY time (time),
  6.     ->   KEY node (node_nr);
  7.  
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 '' at line 6

What do You think is wrong in the code?thanks.
Dec 9 '07 #4
Megi
14 New Member
I have mysql server 5
Dec 9 '07 #5
Megi
14 New Member
I used myadmin:) and it works..less difficult...
Dec 10 '07 #6

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

Similar topics

0
2628
by: Andrew Kuebler | last post by:
When I type: Show keys from ; I do not see foreign keys listed there and I cannot seem to find any command that will list foreign keys. Can anyone help? Also, I notice Innodb tables only store one file unlike MyISAM which stores 3. Are Innodb tables any slower than MyISAM since they store all data in a single file? I am looking to use Innodb for an application
0
1111
by: Joshua Spoerri | last post by:
Which version is targetted for optimization of OR searching on two keys, that is, "select * from sometable where f1 = 123 or f2 = 123", as described in http://www.mysql.com/doc/en/Searching_on_two_keys.html ? Thanks -- MySQL General Mailing List
5
7118
by: Randell D. | last post by:
Can anyone tell me what the difference is between keys and indexes? Much appreciated, randelld
0
514
by: Morten Gulbrandsen | last post by:
Hello, starting from some software database spesification, defined in some Enhanced entity relationship diagram, resulting in all kinds of relationships, 1:1 1:Many Many:1
2
1836
by: Jeff Silverman | last post by:
I am working on my first database and I think I want to build a table with a foreign key in it. The O'Reilly book on MySQL says that MySQL does not support foreign keys, but it still talks about them in the section on database design. So, if if I want to use a foreign key, how do I do it? Many thanks,
0
1227
by: DFS | last post by:
It installed as a service, and seemed to start just fine, but on the 'databases' tab of the WinMySQLAdmin ver 1.4, I can't create databases. It shows 'test' but no tables. Right clicking gives me a menu with 4 flush choices Contents of C:\Windows\my.ini follows: #This File was made using the WinMySQLAdmin 1.4 Tool #8/5/2004 12:48:19 PM
2
1554
by: steve | last post by:
Hi, I want to share my experience with you. If you have large tables, and you are doing joins, be extra careful that the keys in the joins have exactly the same size (and type). Don’t mix mediumint and int for example. There is a huge performance hit if your join keys are not the same size. This IS documented on mysql.com, but not everyone reads everything :D Just beware!
2
4173
by: JirkaJ | last post by:
Hello, is it possible(and how?) to make a new database in a specified folder - i.e. /home/me/mysqldb? or how may i install mysql on debian to use this folder for data files? thanks j.
2
1660
by: stevenkwlee | last post by:
Hi I'm new to Access (2003) and i've just been given the horrible horrible task of trying to add extra functionality to an exisiting access database. I'm usually alright in the database front, since i've worked with mysql etc. But this relationship thing is really bugging the heck out of me. First of all there's a few tables which contains primary keys from different tables (they are highlighted in bold) and then a relationship link to it...
1
7600
by: lionelm2007 | last post by:
In mysql, I need to create a table to store the many-to-many relationship of the other two tables. Here is the problem: the first table has three fields that act as the primary key of the table the second table has only one field for the primary key i know the association table will have the primary keys of both tables as its own primary key but it seems that I can't do that. It appears that the three fields primary key in the first...
0
8067
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8157
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8349
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6015
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5479
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3967
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2477
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 we have to send another system
1
1607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1336
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.