| |

VerySource

 Forgot password?
 Register
Search
View: 2370|Reply: 20

An urgent question, an entry question, thank you

[Copy link]

4

Threads

27

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-1-24 23:20:01
| Show all posts |Read mode
Table 1: Student Situation Information Form XS
Student ID Name Professional Name Gender Birth Time Total Credits Remarks
Primary key

Table 2: Course schedule KC
Course number Course name Start semester Hours Credits
Primary key

Table III: Students and curriculum XS_KC
Student No. Course No. Grade Credits
Primary key primary key


The first two tables, I will, how to build the third table, thank you
create table kc (
 Course number char (3) not null primary key,
 Course name char (16) not null,
 Start semester tinyint not null check ((start semester> = 1) and (start semester <= 8)),
 Hours tinyint not null,
 Credits tinyint null
)
go
create table xs (
Student number char (6) not null primary key,
Name char (8) not null,
Professional name char (10) null,
Gender bit not null default '1',
Time of birth smalldatetime not null,
Total credits tinyint null,
Note text null,
constraint chk_sex check (sex in ('1', '0'))
)
go

I ca n’t think of the third table, please help, thank you
I also found the book
Reply

Use magic Report

4

Threads

27

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

 Author| Post time: 2020-2-12 14:45:01
| Show all posts
I ca n’t think of the third table, please help, thank you
I also found the book
Reply

Use magic Report

0

Threads

13

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-2-12 15:30:01
| Show all posts
It's easier to build directly in the Enterprise Manager, and you can set up the relationship after it is built.
Reply

Use magic Report

4

Threads

27

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

 Author| Post time: 2020-2-12 16:15:02
| Show all posts
But the teacher wants t-SQL
Reply

Use magic Report

4

Threads

27

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

 Author| Post time: 2020-2-12 16:45:01
| Show all posts
To write in SQL
Reply

Use magic Report

4

Threads

27

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

 Author| Post time: 2020-2-12 17:30:02
| Show all posts
Not set in the interface
Reply

Use magic Report

0

Threads

13

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-2-12 19:00:01
| Show all posts
CREATE TABLE [dbo]. [Xs_kc] (
[Student ID] [char] (6) COLLATE Chinese_PRC_CI_AS NOT NULL,
[Course number] [char] (3) COLLATE Chinese_PRC_CI_AS NOT NULL,
[Results] [decimal] (18, 0) NULL,
[Credit] [int] NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo]. [Xs_kc] WITH NOCHECK ADD
CONSTRAINT [PK_xs_kc] PRIMARY KEY CLUSTERED
(
                [student ID],
[Course number]
) ON [PRIMARY]
GO

ALTER TABLE [dbo]. [Xs_kc] ADD
CONSTRAINT [FK_xs_kc_kc] FOREIGN KEY
(
[Course number]
) REFERENCES [dbo]. [Kc] (
[Course number]
),
CONSTRAINT [FK_xs_kc_xs] FOREIGN KEY
(
                [student ID]
) REFERENCES [dbo]. [Xs] (
                [student ID]
)
GO
Reply

Use magic Report

0

Threads

43

Posts

29.00

Credits

Newbie

Rank: 1

Credits
29.00

 China

Post time: 2020-2-12 20:30:01
| Show all posts
It seems that the landlord is passionate about writing code
Top you a lung!
Reply

Use magic Report

4

Threads

27

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

 Author| Post time: 2020-2-12 21:00:01
| Show all posts
[Student ID] [char] (6) COLLATE Chinese_PRC_CI_AS 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 21:15:01
| Show all posts
[Student ID] [char] (6) COLLATE Chinese_PRC_CI_AS NOT NULL
Explain it, thank you
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