if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ENSEIGNANT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ENSEIGNANT]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FACEAFACE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[FACEAFACE]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FACEAFACEENSEIGNANT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[FACEAFACEENSEIGNANT]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GROUPE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[GROUPE]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MATIERE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[MATIERE]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SALLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[SALLE]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TYPESALLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[TYPESALLE]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[USERS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[USERS]
GO

CREATE TABLE [dbo].[ENSEIGNANT] (
	[NOMPRENOM] [varchar] (50) COLLATE French_CI_AS NULL ,
	[PHONE] [varchar] (50) COLLATE French_CI_AS NULL ,
	[EQTDAFAIRE] [int] NULL ,
	[MAIL] [varchar] (50) COLLATE French_CI_AS NULL ,
	[NOMCOURT] [varchar] (50) COLLATE French_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[FACEAFACE] (
	[HEUREDEB] [int] NULL ,
	[TYPESEANCE] [varchar] (50) COLLATE French_CI_AS NULL ,
	[SALLE] [varchar] (50) COLLATE French_CI_AS NULL ,
	[TYPESALLE] [varchar] (50) COLLATE French_CI_AS NULL ,
	[MATIERE] [varchar] (50) COLLATE French_CI_AS NULL ,
	[HEUREFIN] [int] NULL ,
	[NOORDRE] [int] NULL ,
	[JOUR] [datetime] NULL ,
	[GROUPE] [int] NULL ,
	[PROMO] [varchar] (50) COLLATE French_CI_AS NULL ,
	[NOSEANCE] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[FACEAFACEENSEIGNANT] (
	[TYPESEANCE] [varchar] (50) COLLATE French_CI_AS NULL ,
	[GROUPE] [int] NULL ,
	[PROMO] [varchar] (50) COLLATE French_CI_AS NULL ,
	[NOORDRE] [int] NULL ,
	[ENSEIGNANT] [varchar] (50) COLLATE French_CI_AS NULL ,
	[MATIERE] [varchar] (50) COLLATE French_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[GROUPE] (
	[PROMO] [varchar] (50) COLLATE French_CI_AS NOT NULL ,
	[NBETUDIANTS] [int] NULL ,
	[NOGROUPE] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[MATIERE] (
	[NBMINSPROJET] [int] NULL ,
	[CODE] [varchar] (50) COLLATE French_CI_AS NULL ,
	[NBMINSTP] [int] NULL ,
	[LIBELLE] [varchar] (50) COLLATE French_CI_AS NULL ,
	[NBMINSASSISTANCE] [int] NULL ,
	[LIENECTS] [varchar] (50) COLLATE French_CI_AS NULL ,
	[NBMINSDS] [int] NULL ,
	[NBMINSTD] [int] NULL ,
	[PROMO] [varchar] (50) COLLATE French_CI_AS NULL ,
	[NBMINSCOURS] [int] NULL ,
	[SEMESTRE] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[SALLE] (
	[CAPACITE] [int] NULL ,
	[NOM] [varchar] (50) COLLATE French_CI_AS NULL ,
	[TYPE] [varchar] (50) COLLATE French_CI_AS NULL ,
	[DESCRIPTIF] [varchar] (50) COLLATE French_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[TYPESALLE] (
	[NBSALLESDECETYPE] [int] NULL ,
	[TYPE] [varchar] (50) COLLATE French_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[USERS] (
	[LOGIN] [varchar] (40) COLLATE French_CI_AS NULL ,
	[PASS] [varchar] (40) COLLATE French_CI_AS NULL ,
	[USERLEVEL] [varchar] (40) COLLATE French_CI_AS NULL 
) ON [PRIMARY]
GO

