use master
go

if exists (select * from sys.databases where name='knowledege')
	drop database knowledege
go

create database knowledege
	on primary(
		name='knowledege1_data',
		filename='D:\\sql\\knowledege1_data.mdf',
		size=3MB,
		maxsize=unlimited,
		filegrowth=10%
	)
	log on(
		name='knowledege1_log',
		filename='D:\\sql\\knowledege1_log.ldf',
		size=5MB,
		maxsize=unlimited,
		filegrowth=10%
	)
GO

use knowledege
go


create table dir(
	id int identity(1,1) primary key not null,--dirid
	name nchar(30) not null default '',--目录名字
	pid int not null default 0 --父级dirid 
)
GO

create table [file](
	id int identity(1,1) primary key not null,--file id
	name nvarchar(100) not null default '',--文件名
	content char(15) not null default '',--文件内容
	gimage int not null default 0,--文件分类id
	did int not null default 0 --所属目录id
)
GO


-- 根目录测试代码
-- insert into()
-- 子目录测试代码
-- insert into()

use knowledege
go

insert into dir(name,pid)
	values('C/C++',0)--1

insert into dir(name,pid)
	values('C#',0)--2

insert into dir(name,pid)
	values('SQL',0)--3

insert into dir(name,pid)
	values('Java',0)--4

insert into dir(name,pid)
	values('HTML',0)--5

insert into dir(name,pid)
	values('css',0)--6

insert into dir(name,pid)
	values('PHP',0)--7

insert into dir(name,pid)
	values('Python',0)--8

insert into dir(name,pid)
	values('Unity3D',0)--9

insert into dir(name,pid)
	values('无限级分类目录演示',0) --10

go

--子目录

use knowledege
go

insert into dir(name,pid)
	values('.net',2)--11

insert into dir(name,pid)
	values('Windows From',2)--12

insert into dir(name,pid)
	values('SQL Server',3)--13

insert into dir(name,pid)
	values('Oracle',3)--14

insert into dir(name,pid)
	values('Sybase',3)--15

insert into dir(name,pid)
	values('Access',3)--16

insert into dir(name,pid)
	values('DB2',3)--17

insert into dir(name,pid)
	values('Android',4)--18

insert into dir(name,pid)
	values('JSP',4)--19

insert into dir(name,pid)
	values('HTML4',5)--20

insert into dir(name,pid)
	values('HTML5',5)--21

insert into dir(name,pid)
	values('JavaScript',5)--22

insert into dir(name,pid)
	values('css2',6)--23

insert into dir(name,pid)
	values('css3',6)--24

go

insert into dir(name,pid)
	values('编辑器功能演示测试文件',0)--25

GO
--file
insert into [file](name,content,gimage,did)
	values('PHP10个实用函数','2797213147',1,25) --1

insert into [file](name,content,gimage,did)
	values('必须收藏的代码','2844520953',2,25) --2

insert into [file](name,content,gimage,did)
	values('MySQL性能优化','3680231704',3,25) --3

insert into [file](name,content,gimage,did)
	values('Java最佳反射实践','5385328448',4,25) --4

insert into [file](name,content,gimage,did)
	values('PHP中9大缓存技术总结','8331967877',0,25) --5

insert into [file](name,content,gimage,did)
	values('史上最全的SQL复习笔记','9605697373',2,25) --6

GO
