I'm trying to work my way through a Java Tutorial.
The author wrote the tutorial to work with MS SQL. I'd like to follow the tutorial using MySQL. I'm not completely sure how to translate the MS SQL script which uses "IDENTITY", "CONSTRAINT", and "CLUSTERED" as you'll see below:
CREATE TABLE [event_person] (
[event_id] [int] NOT NULL,
[person_id] [int] NOT NULL,
CONSTRAINT [PK_event_person] PRIMARY KEY CLUSTERED
(
[event_id] ASC,
[person_id] ASC
)
)
CREATE TABLE [events] (
[id] [int] IDENTITY(1,1) NOT NULL,
[dt] [datetime] NULL,
[name] [nvarchar](50) NULL,
CONSTRAINT [PK_events] PRIMARY KEY CLUSTERED
(
[id] ASC
)
)
CREATE TABLE [people] (
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](50) NOT NULL,
CONSTRAINT [PK_people] PRIMARY KEY CLUSTERED
(
[id] ASC
)
)
This is as far as I have been able to get with it:
CREATE TABLE event_person (
event_id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
person_id int NOT NULL
);
CREATE TABLE events (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
dt datetime NULL,
name nvarchar(50) NOT NULL);
CREATE TABLE people (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
name nvarchar(50) NOT NULL);
... but I'm concerned that the omitted code will result in lost functionality and even incompatibility with the rest of the tutorial.
Is there a better way I should write this?