0% found this document useful (0 votes)
11 views5 pages

SQL End Term Question

Uploaded by

Nanda S Reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

SQL End Term Question

Uploaded by

Nanda S Reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

SQL End Term Question

Question 1 :

Write SQL queries to:

1. Create a table named users with the following columns:

o user_id (integer, primary key),

o username (varchar),

o email (varchar),

o password_hash (varchar),

o signup_date (timestamp),

o country (varchar).

Question 2 : Write SQL queries to:


Create a table named content with the following columns:

content_id (integer, primary key),

title (varchar),

description (text),

genre (varchar),

release_date (date),

rating (decimal),

content_type (varchar).
Question 3 : Write SQL queries to:

Create a table named Watch_history with the following columns:

 watch_id (INT, Primary Key)


 user_id (INT)
 content_id (INT)
 watch_date (DATETIME)

Question 4 : Create a table named Subscription_Table with the following columns:


 subscription_id (integer, primary key)
 user_id (integer)
 subscription_plan (varchar of length 20)
 start_date (datetime)
 end_date (datetime)
 is_active (boolean)
Question 5 : Create a table named User_Preferences with the following columns:

 preference_id (integer, primary key)


 user_id (integer)
 genre_preference (varchar of length 50)
 language_preference (varchar of length 50)
 content_type_preference (varchar of length 20)

Question 6 : Create a table named LinkedIn_Users with the following columns:

 user_id (integer, primary key)


 first_name (varchar of length 50)
 last_name (varchar of length 50)
 email (varchar of length 100, unique)
 location (varchar of length 50)
 industry (varchar of length 50)
 signup_date (datetime)
Question 7 : CREATE TABLE:

 Defines the table Connections_Table with three columns:


o user_id: Integer, primary key (unique identifier for each row).
o connection_id: Integer, cannot be NULL.
o connected_since: DateTime to store the timestamp.

Question 8 :

CREATE TABLE:

 Defines the table Endorsements_Table with five columns:


o endorsement_id: Integer, primary key (unique for each endorsement).
o user_id: Integer, the ID of the user receiving the endorsement.
o endorsed_by: Integer, the ID of the user providing the endorsement.
o skill: String (up to 255 characters) to store the endorsed skill.
o endorsement_date: DateTime to store the date and time of the endorsement.

Question 9 :
 CREATE TABLE User_activity .
 The table has the following columns:
o activity_id: An integer column.
o user_id: An integer column.
o activity_type: A varchar column to store the type of activity (e.g., 'Post', 'Comment', 'Like',
'Share').
o content: A text column to store the content of the activity.
o post_date: A timestamp column to store the date and time of the post.

You might also like