In a database, what is the correct term for a single column that contains one specific category of information for all records?
Cambridge IGCSE · Computer Science (0478)
Databases: แบบฝึกหัด
ข้อปรนัย 5 ข้อ ตรวจให้ทันทีที่ตอบ และข้อเขียน 5 ข้อ พร้อมวิธีทำละเอียด ทั้งหมดจากเรื่อง Databases
Which of the following statements correctly describes a requirement for a field to be used as a primary key in a database table?
Given the table DELIVERIES:
PackageID | Weight | Destination | Urgent
P1 | \( 2.5 \) | Paris | True
P2 | \( 5.0 \) | London | False
P3 | \( 1.5 \) | Paris | False
P4 | \( 10.0 \) | Paris | True
What value is returned by the query: SELECT SUM(Weight) FROM DELIVERIES WHERE Destination = 'Paris' AND Urgent = True;
In a database management system, which of the following best describes the primary purpose of a primary key?
Why is a NationalID field usually a more suitable choice for a primary key than a FirstName field?
Which basic data type would be most suitable for a field named PriceEach that stores values such as \(19.99\) and \(5.50\)?
ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ
Write an SQL statement to select the Model and Year of all cars in a VEHICLES table where the Color is 'Red' and the Price is less than \(15000\).
ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ
Identify the result of the following query based on the data provided:
SELECT Name FROM PRODUCTS WHERE (Stock < 10 AND Price > 5) OR Category = 'Gift' ORDER BY Name ASCENDING;
Name | Stock | Price | Category
Pen | \(20\) | \(2\) | Office
Box | \(5\) | \(12\) | Storage
Card | \(50\) | \(1\) | Gift
Mug | \(8\) | \(15\) | Gift
ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ
A company uses a database table, Staff, to store employee details. The fields in the table are: StaffID, FirstName, LastName, Department, Salary, and DateJoined.
(a) Define the term primary key and explain why StaffID would be a more suitable primary key than LastName.
(b) Suggest the most appropriate data type for the Salary and DateJoined fields.
(c) Write a Structured Query Language (SQL) script to display the FirstName, LastName, and Salary of all staff members in the 'Sales' department who have a salary greater than 30000.
ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ
A fitness center uses a single-table database named GYM_MEMBERS to manage its subscriptions. Consider the following data stored in the table:
MemberID | Name | Category | MonthlyFee | Active
M101 | Sarah | Premium | \(45.00\) | True
M102 | James | Basic | \(25.00\) | True
M103 | Anya | Premium | \(45.00\) | False
M104 | Robert | Basic | \(25.00\) | True
M105 | Chloe | Student | \(20.00\) | True
M106 | David | Premium | \(45.00\) | True
(a) State the output that would be returned by the following SQL query:
SELECT Name FROM GYM_MEMBERS WHERE Category = 'Premium' AND Active = True ORDER BY Name DESCENDING;
(b) Write an SQL script to calculate the total SUM of MonthlyFee for all members who belong to the 'Basic' or 'Student' categories.
(c) The gym manager wants to prevent data entry errors in the MonthlyFee field, specifically ensuring values are not negative. Identify a suitable validation check and explain how it would be implemented for this field.
ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ
* เนื้อหาของ thinka สร้างโดย AI อาจไม่ถูกต้องสมบูรณ์ในทุกกรณี กรุณาใช้เป็นสื่อเสริมและตรวจสอบกับเอกสารอ้างอิงอย่างเป็นทางการ
คุณเห็นเฉลยแล้ว ทีนี้มาตรวจคำตอบของคุณบ้าง
หน้านี้บอกได้ว่าคำตอบที่ดีเป็นอย่างไร แต่บอกไม่ได้ว่าคำตอบของคุณขาดอะไร thinka ตรวจข้อเขียนของคุณตามเกณฑ์ให้คะแนนจริงในราว 15 วินาที
อยากฝึกโจทย์แบบนี้เพิ่มไหม เริ่มฝึกหัวข้อนี้ได้เลย ตรวจให้ทันทีทุกข้อ
เริ่มฝึกเลย