Search
 
SCRIPT & CODE EXAMPLE
 

SQL

how to make oppointment table in database

CREATE TABLE Appointment (
    DoctorID char(1) NOT NULL,
    [Date] date NOT NULL,
    StartTime time(0) NOT NULL CONSTRAINT CHK_StartTime_TenMinute CHECK (DATEPART(MINUTE, StartTime)%10 = 0 AND DATEPART(SECOND, StartTime) = 0),
    EndTime time(0) NOT NULL CONSTRAINT CHK_EndTime_TenMinute CHECK (DATEPART(MINUTE, EndTime)%10 = 0 AND DATEPART(SECOND, EndTime) = 0),
    Status char(1) NOT NULL,
    UserID char(1) NOT NULL,
    Price int NOT NULL,
    CONSTRAINT PK_Appointment PRIMARY KEY CLUSTERED (DoctorID, [Date], StartTime),
    CONSTRAINT CHK_StartTime_BusinessHours CHECK (DATEPART(HOUR, StartTime) > = 9 AND DATEPART(HOUR, StartTime) < = 16),
    CONSTRAINT CHK_EndTime_BusinessHours CHECK (DATEPART(HOUR, EndTime) > = 9 AND DATEPART(HOUR, DATEADD(SECOND, -1, EndTime)) < = 16),
    CONSTRAINT CHK_EndTime_After_StartTime CHECK (EndTime > StartTime));
CREATE INDEX iDoctor_End ON Appointment (DoctorID, [Date], EndTime);
Comment

PREVIOUS NEXT
Code Example
Sql :: Split Column with delimiter into multiple columns 
Sql :: how to combine rows in sql server procedure 
Sql :: extract domain name from email id mariadb 
Sql :: create query in where clasue 
Sql :: Update Query in SQL Server Table - NAYCode.com 
Sql :: What logs are available on RDS MySQL? 
Sql :: sql get frist of month 
Sql :: como hacer una consulta de un registro que no esta en una tabla en mysql 
Sql :: VYSTUPNI PARAMETR ULOZENE PROCEDURY SQL 
Sql :: select from diffrent tables 
Sql :: BSD sed: extra characters at the end of d command 
Sql :: select statement to print shortest name 
Sql :: oracle lower in where clause 
Sql :: SQL CHECK Constraint in Existing Table 
Sql :: write sql query to show the details start from digit 
Sql :: adding primery key constraint to a column 
Sql :: hex string sql becomes int64 
Sql :: can you create views in dbbrowser 
Sql :: Grant All Priveleges On All Databases 
Sql :: how many rows affected in sqllite 
Sql :: oracle table change tablespace lob column 
Sql :: oserror mysql_config not found virtualenv 
Sql :: mysql database hyphen 
Sql :: mariadb datetime change to microseconds 
Sql :: how to fetch highest score in minimum time using mysql 
Sql :: oracle 11g forget password 
Sql :: mysql docker image arjun 
Sql :: delete query 
Sql :: microsoft sql server import bak file 
Sql :: print pl sql 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =