Book shop onlayn savdo markazi
Sharti (biznes jarayoni qanday ishlaydi?)
Book shop onlayn savdo markazidan mijoz sotib olishi va kitobni sotuvga qo‘yishi ER modelda qanday aks etishini tasvirlash.
Jarayon qanday ishlaydi?
______________
Mijoz “Book shop onlayn savdo markazi”dan kitobni sotib olishi yoki sotuvga qo‘yishi mumkin.
Obyektlar va ularning attributlari.
Obyektlar:
BookType – qanday turdagi kitoblar borligini aks ettiradigan obyekt.
Book– kitob turi va seriaysi aks etadigan obyekt.
Price – kitobning 3 xil holatdagi narxini aks ettirgan obyekt
Language– kitobni turli tillarda tanlash imkonini berobyekt.
Condition –kitobning 3 xil holatini aks ettiruvchi obyekt.
CoverType– kitobni muqovasini aks ettiruvchi obyekt.
Users –foydalanuvchi turini xaridor yoki sotuvchi maqomini aks ettiruvchi obyekt.
Orders – buyurtma haqidagi barcha ma’lumotlarni rasmiylashtirish jarayonini aks ettiruvchi obyekt.
Attributlari:
T/r
|
Obyekt nomi
|
Attributlari
|
|
BookType
|
Id
Title
Bookcover
languageId
conditionId
PublisherId
|
|
Book
|
Id
BookTypeId
Series
|
|
Price
|
Id
BooktypeId
ConditionId
Price
|
|
Language
|
Id
Language
|
|
Condition
|
Id
Condition
|
|
CoverType
|
Id
Typename
|
|
Users
|
Id
Fullname
Phonenumber
|
|
Orders
|
OrdersId
UsersId
BookId
Type
Orderstime
Summa
|
Relatsion jadval
Normalizatsiya qoidalariga mosligi
SQL script
USE bookshop_rent
GO
IF DB_NAME() <> N'bookshop_rent' SET NOEXEC ON
GO
--
-- Create table [dbo].[users]
--
PRINT (N'Create table [dbo].[users]')
GO
CREATE TABLE dbo.users (
usersid int IDENTITY,
fullname nvarchar(50) NOT NULL,
phonenumber varchar(50) NOT NULL,
PRIMARY KEY CLUSTERED (usersid)
)
ON [PRIMARY]
GO
--
-- Create table [dbo].[publisher]
--
PRINT (N'Create table [dbo].[publisher]')
GO
CREATE TABLE dbo.publisher (
publisherid int IDENTITY,
name nvarchar(50) NOT NULL,
address nvarchar(100) NOT NULL,
phonenumber varchar(20) NOT NULL,
PRIMARY KEY CLUSTERED (publisherid),
UNIQUE (phonenumber)
)
ON [PRIMARY]
GO
--
-- Create table [dbo].[language]
--
PRINT (N'Create table [dbo].[language]')
GO
CREATE TABLE dbo.language (
languageid int NOT NULL,
language nvarchar(50) NOT NULL,
PRIMARY KEY CLUSTERED (languageid)
)
ON [PRIMARY]
GO
--
-- Create table [dbo].[CoverType]
--
PRINT (N'Create table [dbo].[CoverType]')
GO
CREATE TABLE dbo.CoverType (
CoverTypeId int IDENTITY,
TypeName nvarchar(50) NOT NULL,
PRIMARY KEY CLUSTERED (CoverTypeId)
)
ON [PRIMARY]
GO
--
-- Create table [dbo].[condition]
--
PRINT (N'Create table [dbo].[condition]')
GO
CREATE TABLE dbo.condition (
conditionid int IDENTITY,
condition nvarchar(50) NOT NULL,
PRIMARY KEY CLUSTERED (conditionid)
)
ON [PRIMARY]
GO
--
-- Create table [dbo].[author]
--
PRINT (N'Create table [dbo].[author]')
GO
CREATE TABLE dbo.author (
authorId int IDENTITY,
firstname nvarchar(50) NOT NULL,
lastname nvarchar(50) NOT NULL,
birthplace varchar(50) NULL,
PRIMARY KEY CLUSTERED (authorId)
)
ON [PRIMARY]
GO
--
-- Create table [dbo].[bookType]
--
PRINT (N'Create table [dbo].[bookType]')
GO
CREATE TABLE dbo.bookType (
bookTypeId int IDENTITY,
title nvarchar(500) NOT NULL,
bookcover int NOT NULL,
languageId int NOT NULL,
conditionId int NOT NULL,
publisherId int NOT NULL,
authorid int NULL,
PRIMARY KEY CLUSTERED (bookTypeId)
)
ON [PRIMARY]
GO
--
-- Create foreign key [FK_booktitle] on table [dbo].[bookType]
--
PRINT (N'Create foreign key [FK_booktitle] on table [dbo].[bookType]')
GO
ALTER TABLE dbo.bookType
ADD CONSTRAINT FK_booktitle FOREIGN KEY (bookcover) REFERENCES dbo.CoverType (CoverTypeId)
GO
--
-- Create foreign key [FK_booktitle_author_authorId] on table [dbo].[bookType]
--
PRINT (N'Create foreign key [FK_booktitle_author_authorId] on table [dbo].[bookType]')
GO
ALTER TABLE dbo.bookType
ADD CONSTRAINT FK_booktitle_author_authorId FOREIGN KEY (authorid) REFERENCES dbo.author (authorId)
GO
--
-- Create foreign key [FK_booktitle_condition_conditionid] on table [dbo].[bookType]
--
PRINT (N'Create foreign key [FK_booktitle_condition_conditionid] on table [dbo].[bookType]')
Do'stlaringiz bilan baham: |