Compare commits
1 Commits
ef9ebbaddd
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| d876ba1e3b |
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : SQL Server
|
||||
Source Server Type : SQL Server
|
||||
Source Server Version : 15004410
|
||||
Source Host : sqlmsksbr.com:1433
|
||||
Source Catalog : book
|
||||
Source Schema : dbo
|
||||
|
||||
Target Server Type : SQL Server
|
||||
Target Server Version : 15004410
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 23/12/2024 22:04:15
|
||||
*/
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for books
|
||||
-- ----------------------------
|
||||
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[books]') AND type IN ('U'))
|
||||
DROP TABLE [dbo].[books]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[books] (
|
||||
[book_name] nvarchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL,
|
||||
[book_type] nvarchar(255) COLLATE Chinese_PRC_CI_AS NULL,
|
||||
[book_id] int NOT NULL,
|
||||
[borrowed_by] int NULL,
|
||||
[ISBN] nvarchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL
|
||||
)
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[books] SET (LOCK_ESCALATION = TABLE)
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for students
|
||||
-- ----------------------------
|
||||
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[students]') AND type IN ('U'))
|
||||
DROP TABLE [dbo].[students]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[students] (
|
||||
[student_name] nvarchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL,
|
||||
[student_id] int NOT NULL,
|
||||
[student_class] nvarchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL,
|
||||
[student_gender] nvarchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL
|
||||
)
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[students] SET (LOCK_ESCALATION = TABLE)
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for users
|
||||
-- ----------------------------
|
||||
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[users]') AND type IN ('U'))
|
||||
DROP TABLE [dbo].[users]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[users] (
|
||||
[username] nvarchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL,
|
||||
[password] nvarchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL
|
||||
)
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[users] SET (LOCK_ESCALATION = TABLE)
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- View structure for rents
|
||||
-- ----------------------------
|
||||
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[rents]') AND type IN ('V'))
|
||||
DROP VIEW [dbo].[rents]
|
||||
GO
|
||||
|
||||
CREATE VIEW [dbo].[rents] AS SELECT students.*,books.*
|
||||
FROM students
|
||||
JOIN books
|
||||
on students.student_id=books.borrowed_by
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Indexes structure for table books
|
||||
-- ----------------------------
|
||||
CREATE NONCLUSTERED INDEX [b_id_index]
|
||||
ON [dbo].[books] (
|
||||
[book_id] ASC
|
||||
)
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Indexes structure for table students
|
||||
-- ----------------------------
|
||||
CREATE NONCLUSTERED INDEX [s_id_index]
|
||||
ON [dbo].[students] (
|
||||
[student_id] ASC
|
||||
)
|
||||
GO
|
||||
|
||||
Reference in New Issue
Block a user