Sample Exam Questions

From the objective of OSS-DB Exam Silver
S3.1 SQL commands (Data types)

Sample Question

3.09

Choose one incorrect description of the data types available in PostgreSQL.

  1. integer is a 4-byte integer that can safely contain up to 10 digits.
  2. real and double precision are floating point real numbers, and double precision can perform more accurate operations.
  3. numeric is a numeric type that deals with integers or fractional numbers. Its precision can be defined by specifying the total number of digits and the number of digits after the decimal point.
  4. date is a data type that handles dates, and it does not hold time information.
  5. timestamp is a data type that handles dates and times, and it holds time data in microseconds.
     

※This sample exam is different from those that appear in the actual OSS-DB Exam.
2024/05/01

Answer and Explanation

PostgreSQL supports a variety of data types.
Numeric data types include integer (4 bytes) and bigint (8 bytes) for integers, real and double precision for floating-point numbers, and numeric and decimal for decimal numbers with arbitrary precision.
Because integer is 4 bytes, it can handle integers from -2147483648 to +2147483647. Up to 9 digits is fine, but be aware that 10 digits beyond 2.1 billion may cause overflow.
real is single precision (4 bytes), double precision is double precision (8 bytes), and of course double precision can perform more accurate operations.
numeric is a decimal data type that allows you to specify the total number of digits and the number of digits after the decimal point, such as numeric(8,3). In this case, you can handle numbers like 12345.678.
Data types for handling dates and times include date, which only holds dates, time, which only holds times, and timestamp, which holds both dates and times. The precision of the timestamp type is in microseconds.

This is a question where you need to select the incorrect option, so the correct answer is A.

While the data types you typically use may vary depending on the environment and application, it's important to have a solid understanding of the data types defined in the SQL standard.