LoslegenKostenlos loslegen

Generating descriptive date parts

DATENAME() is an interesting and easy to use function. When you create reports, for example, you may want to show parts of a date in a more understandable manner (i.e. January instead of 1). This is when the DATENAME() function proves its value. This function will return a string value with a description of the date part you are interested in.

In this exercise, you will become familiar with DATENAME(), by using it to retrieve different date parts. You will work with the first_vote_date column from the voters table.

Diese Übung ist Teil des Kurses

Functions for Manipulating Data in SQL Server

Kurs anzeigen

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

SELECT 
	first_name,
	last_name,
	first_vote_date,
    -- Select the name of the month of the first vote
	___(___, ___) AS first_vote_month
FROM voters;
Code bearbeiten und ausführen