Eduqas A-Level Computer Science A500QS
Data Structures: Arrays, Records and Hash Tables
Stacks, Queues, Linked Lists and Trees
Boolean Logic and Simplification
Algorithms, Pseudo-Code and Programming Constructs
Variables, Scope, Parameters and Identifiers
Recursion and Modular Programming
Sorting Algorithms
Searching and Shortest-Path Algorithms
Big O Notation and Algorithm Efficiency
Validation, Verification and Testing
Data Compression
Programming Paradigms and Computer Languages
Systems Analysis, Maintenance and Documentation
System Design and Human-Computer Interaction
Software Engineering Tools and Translators
Computing, Society and the Law
Computer Architecture, the Processor and Assembly Language
Input, Output and Secondary Storage
Networks, Protocols and the Internet
Data Transmission and Network Performance
Number Systems and Binary Arithmetic
Data Types, Characters and Floating Point
Files, Records and File Organisation
Databases, Normalisation and Entity Modelling
SQL, Big Data and Distributed Systems
The Operating System and Its Modes
Interrupts, Memory Management and Scheduling
Types of Software System
Data Security, Cryptography and Attack
SQL, Big Data and Distributed Systems
Creating tables: CREATE TABLE, data types and keys
- 3 things to know
- Component 2
Overview
Writing the statement that builds a table — column names and their data types, the PRIMARY KEY clause and the NOT NULL constraint.
What you need to know
Answer each one before you reveal it.
What is the purpose of the PRIMARY KEY clause in a CREATE TABLE statement?
What does the NOT NULL constraint do?
Questions from this subtopic
Each one with the model answer underneath.
- 1
A school needs a table called Pupil with PupilID as a whole number and Surname as twenty characters. Write the SQL.
Model answer
CREATE TABLE Pupil (PupilID Int, Surname Char(20)). The brackets enclose the column list and each column name is followed by its data type.
- 2
What is the purpose of the PRIMARY KEY clause in a CREATE TABLE statement?
Model answer
The PRIMARY KEY clause names the column whose value uniquely identifies each row. The database system then rejects any duplicate or empty value in that column.
- 3
Write SQL to create a table Pupil in which PupilID is a whole-number primary key and Surname is twenty characters that may not be left empty.
Model answer
CREATE TABLE Pupil (PupilID Int PRIMARY KEY, Surname Char(20) NOT NULL). The second constraint forces a surname to be supplied in every row.
- 4
What does the NOT NULL constraint do?
Model answer
The NOT NULL constraint prevents a column being left empty. The database system refuses any row that has no value in that column.
- 5
Which SQL data type stores a whole number such as a year group?
Model answer
Int is the data type for a whole number. Int stores a year group of 11 with no decimal part.
- 6
What does Char(n) mean in a table definition?
Model answer
Char(n) declares a fixed-length text column of n characters. Char(30) reserves thirty character positions in every row.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in SQL, Big Data and Distributed Systems, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.