NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

SQL Part MILESTONE

Kumar Shubham

1)
create database Movie_db;
use Movie_db;

create table Rating(id int primary key,
rating int, user_id int, movie_id int);

create table Users( id int primary key,
first_name varchar(50), last_name varchar(50),
email varchar(50));

create table Tags( id int primary key,
tag varchar(50), user_id int, movie_id int);

create table Movies(id int primary key,
name varchar(50), description varchar(50));

2)
insert into rating values(1, 2.5, 123, 12)
insert into rating values(2, 3.0, 456, 13)
insert into rating values(3, 4.0, 789, 14)
insert into rating values(4, 4.5, 101, 15)


insert into Users values(1,'Kumar', 'Aryan', '[email protected]')
insert into Users values(2,'Jhon', 'Wick', '[email protected]')
insert into Users values(3,'Wasim', 'Akram', '[email protected]')
insert into Users values(4,'Umran', 'Malik', '[email protected]')

insert into Tags values(1,'Horror', 'k_Aryan', 12)
insert into Tags values(2,'Comedy', 'J_Wick', 13)
insert into Tags values(3,'Action', 'W_Akram', 14)
insert into Tags values(4,'Thriller', 'U_Malik', 15)

insert into Movies values(1,'Ghost Diary', 'it's a Horror movie')
insert into Movies values(2,'Bhagam Bhag', 'it's a Comedy movie')
insert into Movies values(3,'Dhoom 2', 'it's a Action movie')
insert into Movies values(4,'Drishyam', 'it's a Thriller movie')

3)
CREATE PROCEDURE SP_RATING_USERS_TAGS_MOVIES
AS
BEGIN
SELECT
a.rating, f.first_name, t.tag, n.name from
Ratings a join Users c on a.id= c.id
join Tags o on o.id = a.id
join Movies b on b.id = o.id
join Ratings d on d.id = c.id
END
EXEC SP_RATING_USERS_TAGS_MOVIES
4)
CREATE PROCEDURE SP_Para_Name @rating int, @first_name varchar(50)
AS
BEGIN
SELECT r.rating, u.user_id, f.first_name, e.email
From Ratings a join Users b on a.id=b.id
where r.rating= @rating
and f.first_name= @first_name
END
declare @first_name varchar(50)
exec SP_Para_Name

     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.