SQL query flashcard
Flashcard
•
Computers
•
University
•
Practice Problem
•
Hard
Sumithra M
FREE Resource
Student preview

20 questions
Show all answers
1.
FLASHCARD QUESTION
Front
How do we Insert a new patient record with name, age, gender, and diagnosis having the values ('Anna Cruz', 35, 'F', 'Diabetes') using SQL? refer to the table structure below
CREATE DATABASE HospitalDB;
CREATE TABLE Patients (
PatientID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(100),
Age INT,
Gender CHAR(1),
Diagnosis VARCHAR(255)
);
Back
INSERT INTO Patients (Name, Age, Gender, Diagnosis) VALUES ('Anna Cruz', 35, 'F', 'Diabetes');
2.
FLASHCARD QUESTION
Front
How do we update the GPA of a student whose ID is 10234 using SQL? Refer to the table structure below:
CREATE DATABASE UniversityRecords;
CREATE TABLE Students (
StudentID INT PRIMARY KEY,
Name VARCHAR(100),
GPA DECIMAL(3,2)
);
Back
UPDATE Students SET GPA = 3.85 WHERE StudentID = 10234;
3.
FLASHCARD QUESTION
Front
How do we Delete a closed case older than 10 years using SQL? Refer to the table structure below:
CREATE DATABASE LegalCases;
CREATE TABLE Cases (
CaseID INT PRIMARY KEY,
Status VARCHAR(50),
ClosingDate DATE
);
Back
DELETE FROM Cases WHERE Status = 'Closed' AND ClosingDate < '2015-01-01';
4.
FLASHCARD QUESTION
Front
How do we select all employees from the Sales department and sort them by hire date using SQL? Refer to the table structure below:
CREATE DATABASE BusinessDB;
CREATE TABLE Employees (
EmployeeID INT PRIMARY KEY,
Name VARCHAR(100),
Department VARCHAR(100),
HireDate DATE
);
Back
SELECT * FROM Employees WHERE Department = 'Sales' ORDER BY HireDate;
5.
FLASHCARD QUESTION
Front
How do we Group products by category and show the average price per category using SQL? Refer to the table structure below:
CREATE DATABASE RetailInventory;
CREATE TABLE Products (
ProductID INT PRIMARY KEY,
ProductName VARCHAR(100),
Category VARCHAR(100),
Price DECIMAL(10,2)
);
Back
SELECT Category, AVG(Price) AS AvgPrice FROM Products GROUP BY Category;
6.
FLASHCARD QUESTION
Front
How do we retrieve the names of all students with a GPA greater than 3.0 using SQL? Refer to the table structure below:
CREATE DATABASE UniversityRecords;
CREATE TABLE Students (
StudentID INT PRIMARY KEY,
Name VARCHAR(100),
GPA DECIMAL(3,2)
);
Back
SELECT Name FROM Students WHERE GPA > 3.0;
7.
FLASHCARD QUESTION
Front
How do we update the diagnosis of a patient with ID 12345 to 'Hypertension' using SQL? Refer to the table structure provided.
Back
UPDATE Patients SET Diagnosis = 'Hypertension' WHERE PatientID = 12345;
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
Duell Chemistry Periodic Table Trends Flashcard
Flashcard
•
Professional Development
15 questions
The Bechdel Test
Flashcard
•
Professional Development
18 questions
JavaScript Variables, Data Types, and Operators Flashcard
Flashcard
•
University
15 questions
Commander au restaurant : Flashcards
Flashcard
•
KG - University
15 questions
Readings in Philippine History
Flashcard
•
University
15 questions
BONUS POINTS IDA201
Flashcard
•
University
15 questions
Oscar Wilde Flashcard
Flashcard
•
University - Professi...
12 questions
SUBJECTS
Flashcard
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade