Data Definition Language (DDL) & Data Manipulation Language (DML) (Cambridge (CIE) A Level Computer Science): Flashcards

Exam code: 9618

1/28

0Still learning

Know0

  • FrontSQL

    Define Data Definition Language (DDL).

Cards in this collection (28)

  • Define Data Definition Language (DDL).

    DDL is used to build and manage the structure of a relational database, by creating and modifying tables, fields, indexes and relationships.

  • Define Data Manipulation Language (DML).

    DML is used to manage the data stored within the database structures created by DDL, dealing with adding, updating, deleting and retrieving data.

  • What is the difference between DDL and DML?

    DDL structures the database, whereas DML maintains the contents of the database.

  • What syntax do both DDL and DML use?

    Both DDL and DML use SQL syntax to interact with the database.

  • True or False?

    A DBMS needs a different language for DDL and for DML.

    False.

    Most modern DBMSs use SQL to support both DDL and DML operations.

  • DDL defines how data is              by creating and modifying tables, fields, indexes and relationships.

    DDL defines how data is stored by creating and modifying tables, fields, indexes and relationships.

  • What does CREATE DATABASE do?

    CREATE DATABASE creates a new database.

  • What does CREATE TABLE do?

    CREATE TABLE creates a new table with specified fields and data types.

  • What does ALTER TABLE do?

    ALTER TABLE changes an existing table, for example to add or remove fields.

  • Name the seven data types available for attributes.

    CHARACTER, VARCHAR(n), BOOLEAN, INTEGER, REAL, DATE and TIME.

  • What is the difference between CHARACTER and VARCHAR(n)?

    CHARACTER stores fixed-length text, whereas VARCHAR(n) stores variable-length text up to a maximum length of n.

  • Which data type stores whole numbers, and which stores decimal numbers?

    INTEGER stores whole numbers and REAL stores decimal numbers.

  • The data type                stores a True or False value.

    The data type BOOLEAN stores a True or False value.

  • What does PRIMARY KEY (field) do?

    It sets a field as the primary key, the unique identifier for records in that table.

  • Which commands can a PRIMARY KEY clause be used inside?

    It can be used inside a CREATE TABLE command or an ALTER TABLE command.

  • What does FOREIGN KEY (field) REFERENCES Table(Field) do?

    It sets up a foreign key relationship between two tables.

  • What does SELECT ... FROM do?

    SELECT ... FROM retrieves specific columns from a table.

  • What does WHERE do?

    WHERE filters the results based on a condition.

  • Write an SQL statement that lists all students older than 16 from a Students table.

    SELECT * FROM Students WHERE Age > 16

  • What does ORDER BY do?

    ORDER BY sorts the results into ascending or descending order.

  • What does GROUP BY do?

    GROUP BY groups rows that have the same value in specified columns.

  • What does INNER JOIN do?

    INNER JOIN combines rows from two tables where there is a matching key.

  • What is the difference between SUM() and COUNT()?

    SUM() calculates the total of a numeric column, whereas COUNT() counts the number of rows, or the non-null entries in a column.

  • What does AVG() do?

    AVG() calculates the average value of a numeric column.

  • What does INSERT INTO do?

    INSERT INTO adds a new record to a table.

  • What does DELETE FROM do?

    DELETE FROM removes records from a table.

  • What does UPDATE do?

    UPDATE modifies existing data in a table.

  • True or False?

    UPDATE is a DDL command.

    False.

    UPDATE is a DML command, because it changes the data in a table rather than the structure of the table.

Sign up to unlock flashcards

or