| |

VerySource

 Forgot password?
 Register
Search
Author: lehmann

An urgent question, an entry question, thank you

[Copy link]

0

Threads

100

Posts

53.00

Credits

Newbie

Rank: 1

Credits
53.00

 China

Post time: 2020-2-12 21:45:01
| Show all posts
COLLATE Chinese_PRC_CI_AS
This can be removed and written like this:
Student number char (6) NOT NULL
Reply

Use magic Report

4

Threads

27

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

 Author| Post time: 2020-2-12 22:00:01
| Show all posts
What does ALTER TABLE [dbo]. [Xs_kc] WITH NOCHECK ADD // WITH NOCHECK ADD mean?
CONSTRAINT [PK_xs_kc] PRIMARY KEY CLUSTERED // Why CLUSTERED ??
(
                [student ID],
[Course number]
) ON [PRIMARY]
GO
Reply

Use magic Report

0

Threads

100

Posts

53.00

Credits

Newbie

Rank: 1

Credits
53.00

 China

Post time: 2020-2-12 22:30:01
| Show all posts
Automatically generated after building the table with Enterprise Manager. Don't worry about it.
In fact, you can build tables with Enterprise Manager, and then generate SQL scripts, which have this function.
Reply

Use magic Report

4

Threads

27

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

 Author| Post time: 2020-2-12 23:00:01
| Show all posts
What does ALTER TABLE [dbo]. [Xs_kc] WITH NOCHECK ADD // WITH NOCHECK ADD mean?
CONSTRAINT [PK_xs_kc] PRIMARY KEY CLUSTERED // Why CLUSTERED ??
(
                [student ID],
[Course number]
) ON [PRIMARY]
GO
I do n’t understand? ?
Reply

Use magic Report

0

Threads

43

Posts

29.00

Credits

Newbie

Rank: 1

Credits
29.00

 China

Post time: 2020-2-12 23:15:01
| Show all posts
Directly on the database-right-click-new table-fill in the fields, set the type length, set the primary key to save it
Reply

Use magic Report

0

Threads

13

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-2-13 00:30:02
| Show all posts
The option when creating a table, without checking the existing data, directly add constraints.
Reply

Use magic Report

0

Threads

13

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-2-13 06:30:01
| Show all posts
Clustered index
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-13 09:45:01
| Show all posts
CREATE TABLE dbo.XS_KC
(
Student number char (6) NOT NULL,
Course number char (3) NOT NULL,
Grade tinyint NOT NULL,
Credits tinyint NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE dbo.XS_KC ADD CONSTRAINT
PK_XS_KC PRIMARY KEY CLUSTERED
(
        student ID,
Course number
) ON [PRIMARY]

GO
Reply

Use magic Report

0

Threads

100

Posts

53.00

Credits

Newbie

Rank: 1

Credits
53.00

 China

Post time: 2020-2-13 12:00:01
| Show all posts
Arranged a bit:
CREATE TABLE xs_kc (
Student number char (6) NOT NULL,
Course number char (3) NOT NULL,
Score decimal (18, 0) NULL,
Credits int NULL,
CONSTRAINT PK_xs_kc PRIMARY KEY CLUSTERED (student number, course number),-primary key
CONSTRAINT FK_xs_kc_kc FOREIGN KEY (course number) REFERENCES dbo.kc (course number),-foreign key
CONSTRAINT FK_xs_kc_xs FOREIGN KEY (student number) REFERENCES dbo.xs (student number)-foreign key
)
Reply

Use magic Report

0

Threads

100

Posts

53.00

Credits

Newbie

Rank: 1

Credits
53.00

 China

Post time: 2020-2-13 12:15:01
| Show all posts
CREATE TABLE xs_kc (
Student number char (6) NOT NULL,
Course number char (3) NOT NULL,
Score decimal (18, 0) NULL,
Credits int NULL,
CONSTRAINT PK_xs_kc PRIMARY KEY CLUSTERED (student number, course number),-primary key
CONSTRAINT FK_xs_kc_kc FOREIGN KEY (course number) REFERENCES dbo.kc (course number),-foreign key
CONSTRAINT FK_xs_kc_xs FOREIGN KEY (student number) REFERENCES dbo.xs (student number)-foreign key
)
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list