Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6778925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:19:28+00:00 2026-05-26T16:19:28+00:00

I’m trying to create a hypothetical videostore database and this error message comes up

  • 0

I’m trying to create a hypothetical videostore database and this error message comes up everytime I execute this query:

DROP DATABASE videostore
CREATE DATABASE videostore

CREATE TABLE genre
(
  genre_id INT NOT NULL PRIMARY KEY IDENTITY,
  genre_name VARCHAR(15) NOT NULL
);

CREATE TABLE classification
(    
  rating    VARCHAR(2) NOT NULL CONSTRAINT classification_pk PRIMARY KEY,
  description    VARCHAR(100) NOT NULL,    
  minimum_age    INT    NULL,
);

CREATE TABLE format

(    
  format_id    INT    NOT NULL CONSTRAINT format_pk PRIMARY KEY IDENTITY,
  format_name    VARCHAR(8)    NOT NULL,        
  purchase_cost    FLOAT    NOT NULL
);        

CREATE TABLE rental_cost
(    
  rental_cost_id    INT    NOT NULL CONSTRAINT rental_cost_pk PRIMARY KEY IDENTITY,
  rental_name    VARCHAR(15)    NOT NULL,
  rental_cost    FLOAT    NOT NULL,
  rental_days    TINYINT    NOT NULL    
);        

CREATE TABLE customer    
(    
  customer_id    INT    NOT NULL CONSTRAINT customer_pk PRIMARY KEY IDENTITY,
  first_name    VARCHAR(20)    NOT NULL,        
  surname    VARCHAR(20)    NOT NULL,        
  dob    DATETIME    NOT NULL,        
  home_address    VARCHAR(50)    NOT NULL,        
  contact_number    VARCHAR(10)    NOT NULL,        
  referrer_id    INT    NULL    FOREIGN KEY REFERENCES customer(customer_id),    
);

CREATE TABLE movie    

(    
  movie_id    INT    NOT NULL CONSTRAINT movie_pk PRIMARY KEY IDENTITY,
  movie_name    VARCHAR(40)    NOT NULL,        
  year    SMALLINT    NOT NULL,        
  duration    SMALLINT    NULL,         
  descrip    VARCHAR(120)    NULL,         
  classification    VARCHAR(2)    NOT NULL    FOREIGN KEY REFERENCES classification(rating),
  rental_cost_id    INT    NOT NULL    FOREIGN KEY REFERENCES rental_cost(rental_cost_id),    
);

CREATE TABLE copy
(    
  copy_id    INT    NOT NULL    CONSTRAINT copy_pk PRIMARY KEY    IDENTITY,
  movie_id    INT    NOT NULL    FOREIGN KEY REFERENCES movie(movie_id),    
  format_id    INT    NOT NULL    FOREIGN KEY REFERENCES format(format_id),    
);

CREATE TABLE rental
(    
  rental_id    INT    NOT NULL CONSTRAINT rental_pk PRIMARY KEY IDENTITY,
  copy_id    INT    NOT NULL    FOREIGN KEY REFERENCES copy(copy_id),    
  customer_id    INT    NOT NULL    FOREIGN KEY REFERENCES customer(customer_id),    
  rental_date    DATETIME    NOT NULL,        
  return_date    DATETIME    NULL        
);

CREATE TABLE genre_movie                

(    
  genre_id    INT    NOT NULL FOREIGN KEY REFERENCES genre(genre_id),    
  movie_id    INT    NOT NULL FOREIGN KEY REFERENCES movie(movie_id),
  CONSTRAINT genre_movie_pk PRIMARY KEY (genre_id, movie_id)
);    

(Sorry it’s not in the correct format for reading a script with ease, I just really couldn’t work out how to do that.)

Basically when I execute the SQL script it tells me that the object ‘genre’ already exists, but I can’t see it anywhere else in my code.
And the table shouldn’t already exist because I drop the database each time the script is executed right?

Sidenote – if there’s a better way to make it so the database is dropped only if it exists please help me with that also.

Appreciate it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:19:28+00:00Added an answer on May 26, 2026 at 4:19 pm

    I think you need to add USE videostore after the CREATE DATABASE videostore. Otherwise you are creating tables in whatever database you are currently in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.