473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

how to create MUL keys in mysql

14
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 13255
Megi
14
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 Expert 2GB
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
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
I have mysql server 5
Dec 9 '07 #5
Megi
14
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
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...
0
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...
5
by: Randell D. | last post by:
Can anyone tell me what the difference is between keys and indexes? Much appreciated, randelld
0
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
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...
0
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...
2
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...
2
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
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,...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...

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.