Home > database >  Beginners SQL, the teacher released the test on my computer to create is not successful
Beginners SQL, the teacher released the test on my computer to create is not successful

Time:09-17

Class classmate sections to create success, the same operation as a result, the great god answer, thank!!!!!!

The statement is as follows:

The CREATE DATABASE test2
ON
(name=test2_data, filename='c: \ test2_data MDF')
GO

USE test2
GO

The CREATE TABLE S
(Sno char (8),
Sname char (10),
Ssex char (2),
Sage tinyint,
Major char (8),
Address varchar (50),
Mphone char (11)
)
GO
The CREATE TABLE C
(Cno char (6),
Cname char (20),
Ctype char (4),
Ctime tinyint,
Credit tinyint
)
GO
The CREATE TABLE T
(Tno char (8),
Tname char (10),
Tsex char (2),
Tage tinyint,
The Title char (6),
Salary is a decimal (8, 2)
)
GO
The CREATE TABLE TC
(Tno char (8),
Cno char (6),
Tdate char (6),
Remark a decimal (3, 1)
)
GO
The CREATE TABLE SC
(Sno char (8),
Cno char (6),
Sdate char (6),
Score tinyint
)
GO

INSERT INTO S VALUES (' 12001 ', 'jeason', 'male', 21, 'computer',
'Shanghai zhongshan road no. 837', '13312345678')
INSERT INTO S VALUES (' 12003 ', 'Shen Ting', 'woman', 20, 'communications',' 265 made yuhua district of nanjing road ', '13623456781')
INSERT INTO S VALUES (' 12004 ', 'liu' and 'male', 20, 'computer', 'hangzhou jiefang road no. 584', '13134567812')
INSERT INTO S VALUES (' 12005 ', 'wang', 'male', 21, 'communications',' no. 312 zhongshan road, nanjing city ', '18945678123')
INSERT INTO S VALUES (' 12007 ', 'Lu Wenting', 'woman', 19, 'computer', '100 Shanghai guilin road', '18056781234')
GO
INSERT INTO C VALUES (' 1001 ', 'discrete mathematics',' base ', 72, 4)
INSERT INTO C VALUES (' 1002 ', 'C program design,' foundation, 54, 3)
INSERT INTO C VALUES (' 2001 ', 'computer composition principle', 'compulsory', 90, 5)
INSERT INTO C VALUES (' 2002 ', 'database principle', 'compulsory', 72, 4)
INSERT INTO C VALUES (' 3001 ', 'Java programming', 'take', 54, 3)
GO
INSERT INTO T VALUES (' 6002 ', 'Mr. Zhao', 'male', 32, lecturer, 4800)
INSERT INTO T VALUES (' 6005 ', 'yan-hua fang', 'woman', 28, lecturer, 4600)
INSERT INTO T VALUES (' 6006 ', 'wu dawei' and 'male', 45, associate professor, 5700)
INSERT INTO T VALUES (' 6008 ', 'wei-qiang zhu', 'male', 41, associate professor, 5500)
INSERT INTO T VALUES (' 6012 ', 'Jiang Zhonghao' and 'male', 53, 'professor' 6400)
GO
INSERT INTO TC VALUES (' 6002 ', '1002', '2012 autumn, 3.8)
INSERT INTO TC VALUES (' 6005 ', '1002', 'in the spring of 2013, 4.1)
INSERT INTO TC VALUES (' 6002 ', '1002', '2013 autumn, 4.4)
INSERT INTO TC VALUES (' 6005 ', '1001', '2013 autumn, 4.6)
INSERT INTO TC VALUES (' 6006 ', '2001', 'in the spring of 2014, 4.3)
INSERT INTO TC VALUES (' 6008 ', '2002', '2013 autumn, 4.8)
INSERT INTO TC VALUES (' 6012 ', '3001', 'in the spring of 2014, 4.5)
GO
INSERT INTO SC VALUES (' 12001 ', '1001', 'in the autumn of 2013, 75)
INSERT INTO SC VALUES (' 12001 ', '1002', 'in the autumn of 2012, 46)
INSERT INTO SC VALUES (' 12001 ', '1002', 'in the spring of 2013, 55)
INSERT INTO SC VALUES (' 12001 ', '1002', 'in the autumn of 2013, 67)
INSERT INTO SC VALUES (' 12003 ', '1002', 'in the spring of 2013, 78)
INSERT INTO SC VALUES (' 12003 ', '2002', 'in the autumn of 2013, 86)
INSERT INTO SC VALUES (' 12004 ', '1001', 'in the autumn of 2013, 66)
INSERT INTO SC VALUES (' 12004 ', '1002', 'in the autumn of 2012, 88)
INSERT INTO SC VALUES (' 12004 ', '2001', 'in the spring of 2014, 77)
INSERT INTO SC VALUES (' 12004 ', '2002', 'in the autumn of 2013, 95)
INSERT INTO SC VALUES (' 12004 ', '3001', 'in the spring of 2014, 92)
INSERT INTO SC VALUES (' 12007 ', '1001', 'in the autumn of 2013, 85)
INSERT INTO SC VALUES (' 12007 ', '1002', 'in the autumn of 2012, 83)
INSERT INTO SC VALUES (' 12007 ', '2002', 'in the autumn of 2013, 91)
GO


Operation error is as follows:

Message 5123, level 16, state 1, line 1
Try to open or CREATE a physical FILE 'c: \ test2_data MDF', CREATE the FILE encountered operating system error 5 (access denied,),
Message 1802, level 16, state 4, line 1
The CREATE DATABASE failure, unable to CREATE lists some of the file name, please see the relevant error,
Message 911, level 16, state 1, line 6
Database 'test2' was not found, please ensure correctly input the name,
Message 2714, level 16, state 6, line 9
Already exists in the database, called the 'S',
Message 2714, level 16, state 6, line 19
Already exists in the database objects, called 'C'
Message 2714, level 16, state 6, line 27
Already exists in the database, called the 'T',
Message 2714, level 16, state 6, line 36
Already exists in the database objects, called '*'
Message 2714, level 16, state 6, 43 lines
Already exists in the database objects, called 'SC'

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

Line (1) affected

CodePudding user response:

Or without permission to write file under C disk, change the path, or you run this script, run again wrong,

Insert row behind successful that a second possibility is big

CodePudding user response:

Could you tell me how to solve the second case to that? For beginners temporarily is not very good, please, please give a solution

CodePudding user response:

In commonly before you create the object have judgment, if can choose to delete or skipped

CodePudding user response:

C disk permissions problems, you as far as possible on the other plate, path corresponding to the good,

The problem in the database is created,

At the back of the error because the front didn't create success, to solve the problem behind is solved,

The CREATE DATABASE test2
ON
(name=test2_data, filename='F: \ test2_data MDF')
GO

USE test2
null
  • Related