Wednesday, February 23, 2011

Advanced Relation Database */ Movie Quotes */

--The script for the Movie quotes
USE [DoubleTechnicalQuotes]  
 GO  
 /****** Object: Table [dbo].[xQuoteRef] Script Date: 02/23/2011 14:14:00 ******/  
 SET ANSI_NULLS ON  
 GO  
 SET QUOTED_IDENTIFIER ON  
 GO  
 CREATE TABLE [dbo].[xQuoteRef](  
 [xID] [int] IDENTITY(1,1) NOT NULL,  
 [mID] [int] NULL,  
 [aID] [int] NULL,  
 [qID] [int] NULL,  
 PRIMARY KEY CLUSTERED   
 (  
 [xID] ASC  
 )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]  
 ) ON [PRIMARY]  
 GO  
 /****** Object: Table [dbo].[randomizer] Script Date: 02/23/2011 14:14:00 ******/  
 SET ANSI_NULLS ON  
 GO  
 SET QUOTED_IDENTIFIER ON  
 GO  
 CREATE TABLE [dbo].[randomizer](  
 [quoteid] [int] NULL,  
 [randomid] [int] NULL  
 ) ON [PRIMARY]  
 GO  
 /****** Object: Table [dbo].[MovieQuote] Script Date: 02/23/2011 14:14:00 ******/  
 SET ANSI_NULLS ON  
 GO  
 SET QUOTED_IDENTIFIER ON  
 GO  
 SET ANSI_PADDING ON  
 GO  
 CREATE TABLE [dbo].[MovieQuote](  
 [qID] [int] IDENTITY(1,1) NOT NULL,  
 [aID] [int] NULL,  
 [MovieQuote] [varchar](200) NULL,  
 CONSTRAINT [PK__MovieQuo__C276CFE907020F21] PRIMARY KEY CLUSTERED   
 (  
 [qID] ASC  
 )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]  
 ) ON [PRIMARY]  
 GO  
 SET ANSI_PADDING OFF  
 GO  
 /****** Object: Table [dbo].[Movie] Script Date: 02/23/2011 14:14:00 ******/  
 SET ANSI_NULLS ON  
 GO  
 SET QUOTED_IDENTIFIER ON  
 GO  
 SET ANSI_PADDING ON  
 GO  
 CREATE TABLE [dbo].[Movie](  
 [mID] [int] IDENTITY(1,1) NOT NULL,  
 [MovieName] [varchar](50) NULL,  
 PRIMARY KEY CLUSTERED   
 (  
 [mID] ASC  
 )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]  
 ) ON [PRIMARY]  
 GO  
 SET ANSI_PADDING OFF  
 GO  
 /****** Object: Table [dbo].[ActorActress] Script Date: 02/23/2011 14:14:00 ******/  
 SET ANSI_NULLS ON  
 GO  
 SET QUOTED_IDENTIFIER ON  
 GO  
 SET ANSI_PADDING ON  
 GO  
 CREATE TABLE [dbo].[ActorActress](  
 [aID] [int] IDENTITY(1,1) NOT NULL,  
 [ActorActressName] [varchar](50) NULL,  
 PRIMARY KEY CLUSTERED   
 (  
 [aID] ASC  
 )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]  
 ) ON [PRIMARY]  
 GO  
 SET ANSI_PADDING OFF  
 GO  

--Select statements for the Movie quotes.
select m.MovieName Movie, a.ActorActressName Actor_or_Actress, q.MovieQuote Quote  
 from Movie m  
 inner join xQuoteRef x  
      on m.mID = x.mID  
 inner join ActorActress a  
      on a.aID = x.aID  
 inner join MovieQuote q  
      on q.aID = x.qID  
 where q.MovieQuote like '%Hey%'  
 select m.MovieName Movie, a.ActorActressName Actor_or_Actress, q.MovieQuote Quote  
 from Movie m  
 inner join xQuoteRef x  
      on m.mID = x.mID  
 inner join ActorActress a  
      on a.aID = x.aID  
 inner join MovieQuote q  
      on q.aID = x.qID  
 where a.ActorActressName = 'Dr. Rumack'  

No comments:

Post a Comment

Classes

Programming II

Advanced Relational Database

Followers