НачатьНачать бесплатно

Storing dates in a database

In this exercise, you will practice your knowledge of the different data types you can use in SQL Server. You will add more columns to the voters table and decide which is the most appropriate data type for each of them.

The syntax for adding a new column in a table is the following:

ALTER TABLE table_name
ADD column_name data_type

Remember, the most common date/time data types are:

  • date
  • time
  • datetime
  • datetime2
  • smalldatetime.

Это упражнение является частью курса

Functions for Manipulating Data in SQL Server

Посмотреть курс

Интерактивное практическое упражнение

Попробуйте выполнить это упражнение, дополнив этот пример кода.

ALTER TABLE voters
ADD last_vote_date ____;
Редактировать и запускать код