Introduction
Boolean
Date and time
Summary
40. Summary - Exercise 1

Instruction

Finally! We did a lot of work in this part of the course. Let' revise what we learned.

We found out about

  • text data types (varchar, char, text/clob),
  • numbers (integer, real, double, decimal),
  • logical (boolean),
  • date and time (date, time, datetime).
These are the basic data types but each database has other, more specialised data types for various purposes.

Let's do a few exercises for review.

Exercise

Peter wants to create a table couple where he wants to store information about people who got lucky together using his website. Create the table for him with the following columns:

  • user1 (integer),
  • user2 (integer),
  • first_date (date),
  • from_first_sight (boolean),
  • description (text).

Stuck? Here's a hint!

Type

CREATE TABLE couple (
    user1 int,
    user2 int,
    first_date date,
    from_first_sight boolean,
    description text
);

Console

Code editor

Result

TableConsole