Home > database >  Homework, your bosses, to solve
Homework, your bosses, to solve

Time:09-17

Design students table, name field, gender and interest demands gender field radio (' male '/' female '), hobby field can multi-select (' basketball ', 'football', 'music', 'read', 'drawing', 'photography'), with command completion,

CodePudding user response:

Use the test
The create table students
(sname nvarchar (50),
Ssex char (2),
Shobby nvarchar (50)
)
The ALTER TABLE students WITH NOCHECK
ADD the CONSTRAINT col1_check CHECK (ssex in (' male ', 'woman'))

The ALTER TABLE students WITH NOCHECK
ADD the CONSTRAINT col2_check CHECK (shobby in (' basketball ', 'football', 'music', 'read', 'drawing', 'photography'))

Behind two statements as constraint, I don't know the rules restricting field is content with the requirement, if you say this, gender limit the men and women, hobby is limiting the six, write so that is no problem,

CodePudding user response:

Table is to create a success, but two days later statement syntax error