473,416 Members | 1,562 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,416 software developers and data experts.

I Specify explicitly TYPE = InnoDB But My SQL gives me TYPE=MyISAM ?

Dear MySQL developers,

Could some experienced Database developer please take a look at this ?

It is supposed to be plain SQL2.

How can it be coded under MySQL

Especially all referential triggered actions.

According to the manual :

"7.5.5.2 Foreign Key Constraints
Starting from version 3.23.43b InnoDB features foreign key constraints.
InnoDB is the first MySQL table type which allows you to define foreign
key constraints to guard the integrity of your data."
Yours Sincerely

Morten Gulbrandsen

===
--------------
DROP TABLE IF EXISTS EMPLOYEE
--------------

Query OK, 0 rows affected (0.01 sec)

--------------
CREATE TABLE EMPLOYEE
(
FNAME VARCHAR(15) NOT NULL,
MINIT CHAR,
LNAME VARCHAR(15) NOT NULL,
SSN CHAR(9) NOT NULL,
BDATE DATE,
ADDRESS VARCHAR(30),
SEX CHAR,
SALARY DECIMAL(10,2),
SUPERSSN CHAR(9),
DNO INT NOT NULL DEFAULT 1,
CONSTRAINT EMPPK
PRIMARY KEY (SSN),

CONSTRAINT EMPSUPERFK
FOREIGN KEY (SUPERSSN) REFERENCES EMPLOYEE(SSN)
ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT EMPDEPTFK
FOREIGN KEY (DNO) REFERENCES DEPARTMENT(DNUMBER)
ON DELETE SET DEFAULT ON UPDATE CASCADE) TYPE = InnoDB
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
DROP TABLE IF EXISTS DEPARTMENT
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
CREATE TABLE DEPARTMENT
(
DNAME VARCHAR(15) NOT NULL,
DNUMBER INT NOT NULL,
MGRSSN CHAR(9) NOT NULL DEFAULT '888665555',
MGRSTARTDATE DATE,
CONSTRAINT DEPTPK
PRIMARY KEY (DNUMBER),
CONSTRAINT DEPTSK
UNIQUE (DNAME),
CONSTRAINT DEPTMGRFK
FOREIGN KEY (MGRSSN) REFERENCES EMPLOYEE(SSN)
ON DELETE SET DEFAULT ON UPDATE CASCADE ) TYPE = InnoDB
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
DROP TABLE IF EXISTS DEPT_LOCATIONS
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
CREATE TABLE DEPT_LOCATIONS
(
DNUMBER INT NOT NULL,
DLOCATION VARCHAR(15) NOT NULL,
PRIMARY KEY (DNUMBER, DLOCATION),
FOREIGN KEY (DNUMBER) REFERENCES DEPARTMENT(DNUMBER)
ON DELETE CASCADE ON UPDATE CASCADE ) TYPE = InnoDB
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
DROP TABLE IF EXISTS PROJECT
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
CREATE TABLE PROJECT
(
PNAME VARCHAR(15) NOT NULL,
PNUMBER INT NOT NULL,
PLOCATION varchar(15),
DNUM int NOT NULL,
PRIMARY KEY (PNUMBER),
UNIQUE (PNAME),
FOREIGN KEY (DNUM) REFERENCES DEPARTMENT (DNUMBER)) TYPE = InnoDB
--------------

Query OK, 0 rows affected (0.02 sec)

--------------
DROP TABLE IF EXISTS WORKS_ON
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
CREATE TABLE WORKS_ON
(
ESSN CHAR(9) NOT NULL,
PNO INT NOT NULL,
HOURS DECIMAL(3,1) NOT NULL,
PRIMARY KEY (ESSN, PNO),
FOREIGN KEY (ESSN) REFERENCES EMPLOYEE(SSN),
FOREIGN KEY (PNO) REFERENCES PROJECT (PNUMBER))TYPE = InnoDB
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
DROP TABLE IF EXISTS DEPENDENT
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
CREATE TABLE DEPENDENT
(
ESSN CHAR(9) NOT NULL,
DEPENDENT_NAME VARCHAR(15) NOT NULL,
SEX CHAR,
BDATE DATE,
RELATIONSHIP VARCHAR(8),
PRIMARY KEY (ESSN, DEPENDENT_NAME),
FOREIGN KEY (ESSN) REFERENCES EMPLOYEE(SSN))TYPE = InnoDB
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
SHOW CREATE TABLE EMPLOYEE
--------------

+----------+------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
--------------+
| Table | Create Table
|
+----------+------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
--------------+
| EMPLOYEE | CREATE TABLE `employee` (
`FNAME` varchar(15) NOT NULL default '',
`MINIT` char(1) default NULL,
`LNAME` varchar(15) NOT NULL default '',
`SSN` varchar(9) NOT NULL default '',
`BDATE` date default NULL,
`ADDRESS` varchar(30) default NULL,
`SEX` char(1) default NULL,
`SALARY` decimal(10,2) default NULL,
`SUPERSSN` varchar(9) default NULL,
`DNO` int(11) NOT NULL default '1',
PRIMARY KEY (`SSN`)
) TYPE=MyISAM |
+----------+------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
--------------+
1 row in set (0.00 sec)

--------------
SHOW CREATE TABLE DEPARTMENT
--------------

+------------+----------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
-+
| Table | Create Table
|
+------------+----------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
-+
| DEPARTMENT | CREATE TABLE `department` (
`DNAME` varchar(15) NOT NULL default '',
`DNUMBER` int(11) NOT NULL default '0',
`MGRSSN` varchar(9) NOT NULL default '888665555',
`MGRSTARTDATE` date default NULL,
PRIMARY KEY (`DNUMBER`),
UNIQUE KEY `DNAME` (`DNAME`)
) TYPE=MyISAM |
+------------+----------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
-+
1 row in set (0.00 sec)

--------------
SHOW CREATE TABLE DEPT_LOCATIONS
--------------

+----------------+------------------------------------------------------
------------------------------------------------------------------------
-------------------------------------------------+
| Table | Create Table
|
+----------------+------------------------------------------------------
------------------------------------------------------------------------
-------------------------------------------------+
| DEPT_LOCATIONS | CREATE TABLE `dept_locations` (
`DNUMBER` int(11) NOT NULL default '0',
`DLOCATION` varchar(15) NOT NULL default '',
PRIMARY KEY (`DNUMBER`,`DLOCATION`)
) TYPE=MyISAM |
+----------------+------------------------------------------------------
------------------------------------------------------------------------
-------------------------------------------------+
1 row in set (0.00 sec)

--------------
SHOW CREATE TABLE PROJECT
--------------

+---------+-------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
----------------------------------------------------------+
| Table | Create Table
|
+---------+-------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
----------------------------------------------------------+
| PROJECT | CREATE TABLE `project` (
`PNAME` varchar(15) NOT NULL default '',
`PNUMBER` int(11) NOT NULL default '0',
`PLOCATION` varchar(15) default NULL,
`DNUM` int(11) NOT NULL default '0',
PRIMARY KEY (`PNUMBER`),
UNIQUE KEY `PNAME` (`PNAME`)
) TYPE=MyISAM |
+---------+-------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
----------------------------------------------------------+
1 row in set (0.02 sec)

--------------
SHOW CREATE TABLE WORKS_ON
--------------

+----------+------------------------------------------------------------
------------------------------------------------------------------------
--------------------------------------------------------------+
| Table | Create Table
|
+----------+------------------------------------------------------------
------------------------------------------------------------------------
--------------------------------------------------------------+
| WORKS_ON | CREATE TABLE `works_on` (
`ESSN` char(9) NOT NULL default '',
`PNO` int(11) NOT NULL default '0',
`HOURS` decimal(3,1) NOT NULL default '0.0',
PRIMARY KEY (`ESSN`,`PNO`)
) TYPE=MyISAM |
+----------+------------------------------------------------------------
------------------------------------------------------------------------
--------------------------------------------------------------+
1 row in set (0.00 sec)

--------------
SHOW CREATE TABLE DEPENDENT
--------------

+-----------+-----------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
--+
| Table | Create Table
|
+-----------+-----------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
--+
| DEPENDENT | CREATE TABLE `dependent` (
`ESSN` varchar(9) NOT NULL default '',
`DEPENDENT_NAME` varchar(15) NOT NULL default '',
`SEX` char(1) default NULL,
`BDATE` date default NULL,
`RELATIONSHIP` varchar(8) default NULL,
PRIMARY KEY (`ESSN`,`DEPENDENT_NAME`)
) TYPE=MyISAM |
+-----------+-----------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
--+
1 row in set (0.00 sec)

--------------
SHOW TABLE STATUS FROM company LIKE "EMPLOYEE"
--------------

+----------+--------+------------+------+----------------+-------------+
-----------------+--------------+-----------+----------------+----------
-----------+---------------------+------------+----------------+--------
-+
| Name | Type | Row_format | Rows | Avg_row_length | Data_length |
Max_data_length | Index_length | Data_free | Auto_increment |
Create_time | Update_time | Check_time | Create_options
| Comment |
+----------+--------+------------+------+----------------+-------------+
-----------------+--------------+-----------+----------------+----------
-----------+---------------------+------------+----------------+--------
-+
| employee | MyISAM | Dynamic | 0 | 0 | 0 |
4294967295 | 1024 | 0 | NULL | 2003-07-31
14:37:48 | 2003-07-31 14:37:48 | NULL | | |
+----------+--------+------------+------+----------------+-------------+
-----------------+--------------+-----------+----------------+----------
-----------+---------------------+------------+----------------+--------
-+
1 row in set (0.00 sec)

--------------
SHOW TABLE STATUS FROM company LIKE "DEPARTMENT"
--------------

+------------+--------+------------+------+----------------+------------
-+-----------------+--------------+-----------+----------------+--------
-------------+---------------------+------------+----------------+------
---+
| Name | Type | Row_format | Rows | Avg_row_length | Data_length
| Max_data_length | Index_length | Data_free | Auto_increment |
Create_time | Update_time | Check_time | Create_options
| Comment |
+------------+--------+------------+------+----------------+------------
-+-----------------+--------------+-----------+----------------+--------
-------------+---------------------+------------+----------------+------
---+
| department | MyISAM | Dynamic | 0 | 0 | 0
| 4294967295 | 1024 | 0 | NULL |
2003-07-31 14:37:48 | 2003-07-31 14:37:48 | NULL |
| |
+------------+--------+------------+------+----------------+------------
-+-----------------+--------------+-----------+----------------+--------
-------------+---------------------+------------+----------------+------
---+
1 row in set (0.00 sec)

--------------
SHOW TABLE STATUS FROM company LIKE "DEPT_LOCATIONS"
--------------

+----------------+--------+------------+------+----------------+--------
-----+-----------------+--------------+-----------+----------------+----
-----------------+---------------------+------------+----------------+--
-------+
| Name | Type | Row_format | Rows | Avg_row_length |
Data_length | Max_data_length | Index_length | Data_free |
Auto_increment | Create_time | Update_time | Check_time
| Create_options | Comment |
+----------------+--------+------------+------+----------------+--------
-----+-----------------+--------------+-----------+----------------+----
-----------------+---------------------+------------+----------------+--
-------+
| dept_locations | MyISAM | Dynamic | 0 | 0 |
0 | 4294967295 | 1024 | 0 | NULL |
2003-07-31 14:37:48 | 2003-07-31 14:37:48 | NULL |
| |
+----------------+--------+------------+------+----------------+--------
-----+-----------------+--------------+-----------+----------------+----
-----------------+---------------------+------------+----------------+--
-------+
1 row in set (0.00 sec)

--------------
SHOW TABLE STATUS FROM company LIKE "PROJECT"
--------------

+---------+--------+------------+------+----------------+-------------+-
----------------+--------------+-----------+----------------+-----------
----------+---------------------+------------+----------------+---------
+
| Name | Type | Row_format | Rows | Avg_row_length | Data_length |
Max_data_length | Index_length | Data_free | Auto_increment |
Create_time | Update_time | Check_time | Create_options
| Comment |
+---------+--------+------------+------+----------------+-------------+-
----------------+--------------+-----------+----------------+-----------
----------+---------------------+------------+----------------+---------
+
| project | MyISAM | Dynamic | 0 | 0 | 0 |
4294967295 | 1024 | 0 | NULL | 2003-07-31
14:37:48 | 2003-07-31 14:37:48 | NULL | | |
+---------+--------+------------+------+----------------+-------------+-
----------------+--------------+-----------+----------------+-----------
----------+---------------------+------------+----------------+---------
+
1 row in set (0.00 sec)

--------------
SHOW TABLE STATUS FROM company LIKE "WORKS_ON"
--------------

+----------+--------+------------+------+----------------+-------------+
-----------------+--------------+-----------+----------------+----------
-----------+---------------------+------------+----------------+--------
-+
| Name | Type | Row_format | Rows | Avg_row_length | Data_length |
Max_data_length | Index_length | Data_free | Auto_increment |
Create_time | Update_time | Check_time | Create_options
| Comment |
+----------+--------+------------+------+----------------+-------------+
-----------------+--------------+-----------+----------------+----------
-----------+---------------------+------------+----------------+--------
-+
| works_on | MyISAM | Fixed | 0 | 0 | 0 |
81604378623 | 1024 | 0 | NULL | 2003-07-31
14:37:48 | 2003-07-31 14:37:48 | NULL | | |
+----------+--------+------------+------+----------------+-------------+
-----------------+--------------+-----------+----------------+----------
-----------+---------------------+------------+----------------+--------
-+
1 row in set (0.00 sec)

--------------
SHOW TABLE STATUS FROM company LIKE "DEPENDENT"
--------------

+-----------+--------+------------+------+----------------+-------------
+-----------------+--------------+-----------+----------------+---------
------------+---------------------+------------+----------------+-------
--+
| Name | Type | Row_format | Rows | Avg_row_length | Data_length
| Max_data_length | Index_length | Data_free | Auto_increment |
Create_time | Update_time | Check_time | Create_options
| Comment |
+-----------+--------+------------+------+----------------+-------------
+-----------------+--------------+-----------+----------------+---------
------------+---------------------+------------+----------------+-------
--+
| dependent | MyISAM | Dynamic | 0 | 0 | 0
| 4294967295 | 1024 | 0 | NULL |
2003-07-31 14:37:48 | 2003-07-31 14:37:48 | NULL |
| |
+-----------+--------+------------+------+----------------+-------------
+-----------------+--------------+-----------+----------------+---------
------------+---------------------+------------+----------------+-------
--+
1 row in set (0.00 sec)

Bye
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1721

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Neil Zanella | last post by:
Hello, Is there a way to specify MyISAM for all tables in a given file rather than having to specify it at the end of each table declaration. I think this would make porting databases back and...
0
by: Morten Gulbrandsen | last post by:
Hi Programmers, after this legal statement ALTER TABLE EMPLOYEE TYPE =3D InnoDB; I get=20 Warnings: 0 =20 and still MySQL claims to have to use Type =3D MyISAM,
1
by: Sandra | last post by:
Hello, How do I convert my existing database, which I'm using MySQL ver 4 for Windows and MyISAM table type to store the data, to the new format – InnoDB, without problem ( losing data...) ...
0
by: Marek Kotowski | last post by:
I am new to MySQL and this is a simple question: what table type to choose: MyISAM or INNODB? I need a referential integrity to be checked, so – I know – INNODB is the only choice, at least...
1
by: Craig Stadler | last post by:
mySQL (4.0.20a win32), dual amd2200 machine, 4 gigs of DDR ECC memory. I have a series of 33 tables, identical in structure : (field names shortened) CREATE TABLE `dbtable1` ( `FS`...
3
by: Mike Ho | last post by:
I'm wondering if there is a way to retrieve Foreign Key declaration information on both MyISAM and InnoDB tables. Of course, I understand that MyISAM doesn't support Foreign Keys, however, it...
4
by: Good Man | last post by:
Hi there I have a database with about 20 or so tables, maybe a few thousand rows in each. I am starting to do more complex things with my insertions etc, and I want to start to use...
2
by: crescent_au | last post by:
I've read articles and postings about MyISAM vs InnoDB but I am still a bit unsure about which storage engine to use for my new project. I am developing a website in PHP/MySQL, which includes...
110
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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
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,...
0
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...

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.