0% found this document useful (0 votes)
39 views4 pages

CSE370 Lab Mid Sample

The document provides instructions for a lab midterm in a Database Systems course, including steps to use XAMPP for executing SQL queries. It outlines the creation of a database with four tables and provides sample data to work with, along with specific queries to be run. Students are required to submit their answers in a PDF format after completing the queries and attaching screenshots of their work.
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)
39 views4 pages

CSE370 Lab Mid Sample

The document provides instructions for a lab midterm in a Database Systems course, including steps to use XAMPP for executing SQL queries. It outlines the creation of a database with four tables and provides sample data to work with, along with specific queries to be run. Students are required to submit their answers in a PDF format after completing the queries and attaching screenshots of their work.
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/ 4

CSE370 : Database Systems Lab

Lab Mid | Spring 2024


Section 04

Instructions:

1.​ Open “XAMPP” an use the CLI (Shell) to write down the queries

2.​ Click on the given link. Copy the answer sheet (Click File > Make a copy) and write the
answers:
https://docs.google.com/document/d/1wB7FP-bG20gtFY_ChbPz81ttNAQV___PRxM7F0
bYjf8/edit?usp=sharing
Don’t forget to attach screenshots of the queries (Use Snipping Tool)

3.​ After writing your answers, download the file as pdf (Click File > Download > PDF
Document) and submit it using the given submission form:
https://forms.gle/ybHc8bsqbzN4qzzK6
[Use G-suite email for submission. You can submit the file only once]

4.​ Using any browser except for form submission is totally prohibited. Zero tolerance policy
is followed for any unfair means.

A database and four tables have been created for you, along with the data. Paste the
following queries in the CLI and answer the given questions. Before answering the
questions, please check if all the data has been inserted correctly in all four tables.

.…………………………………………………………………………………………………….

CREATE DATABASE GamingPlatform;


USE GamingPlatform;

CREATE TABLE Players (


Player_id varchar(3),
Player_name varchar(50),
Player_email varchar(50),
Joining_date date,
Level int,
Primary key(Player_id)
);
CREATE TABLE Games (
Game_id varchar(3),
Game_name varchar(100),
Genre varchar(30),
Release_date date,
Primary key(Game_id)
);

CREATE TABLE Achievements (


Achievement_id varchar(3),
Achievement_name varchar(100),
Game_id varchar(3),
Points int,
Primary key(Achievement_id),
Foreign key(Game_id) references Games(Game_id)
);

CREATE TABLE PlayerAchievements (


Player_id varchar(3),
Achievement_id varchar(3),
Unlock_date date,
Primary key(Player_id, Achievement_id),
Foreign key(Player_id) references Players(Player_id),
Foreign key(Achievement_id) references Achievements(Achievement_id)
);

INSERT INTO Players VALUES


('p01', 'Wixen', '[email protected]', '2014-07-05', 60),
('p02', 'D3Watch3r', '[email protected]', '2019-02-15', 20),
('p03', 'BeastMaster64', '[email protected]', '2016-11-27', 35),
('p04', 'Jumping', '[email protected]', '2022-01-12', 31),
('p05', 'Thund3r', '[email protected]', '2016-07-01', 53),
('p06', 'BadBuzz', '[email protected]', '2018-07-05', 20);

INSERT INTO Games VALUES


('g01', 'Valorant', 'FPS', '2020-06-02'),
('g02', 'CSGO', 'FPS', '2012-08-21'),
('g03', 'Witcher 3', 'RPG', '2015-05-18'),
('g04', 'NFS Heat', 'Racing', '2019-11-08');

INSERT INTO Achievements VALUES


('a01', 'Pro-moted', 'g02', 25),
('a02', 'Acer', 'g01', 15),
('a03', 'Short Fuse', 'g02', 15),
('a04', 'Brawler', 'g03', 30),
('a05', 'Warp Speed', 'g04', 40),
('a06', 'Challenger', 'g01', 50);

INSERT INTO PlayerAchievements VALUES


('p01', 'a04', '2016-06-01'),
('p04', 'a02', '2023-01-15'),
('p01', 'a05', '2022-08-05'),
('p02', 'a03', '2023-03-10'),
('p05', 'a01', '2022-07-23'),
('p05', 'a02', '2021-03-05'),
('p01', 'a02', '2020-08-10'),
('p03', 'a04', '2019-02-20');
………………………………………………………………………………………………………

Run appropriate queries to retrieve the requested data below [Use a single query for
each question]:

1.​ Change the level of players having level 20 to level 24.


2.​ Retrieve the player name, player email and their level with level 40-70 and
email domain of ‘gmail’.
3.​ Retrieve the name and release date of games after 2016 in ascending order
4.​ You have decided to increase the level of all the players by 10% whose joining
date is before 2020 (without updating records). Retrieve the name of the players
and their new level as bonusLevel.
5.​ Retrieve the name of achievements along with their game name with points less
than 25
6.​ Retrieve the total number of players who have unlocked at least one
achievement.
7.​ Retrieve the name of players and their levels who have reached a level greater
than any other player
8.​ Retrieve the name of player who have not unlocked any achievements
9.​ Retrieve the players and their total achievement points
10.​ Retrieve the top 3 players with highest number of achievements

You might also like