Comments

NuoDB SQL allows comments in SQL stored procedures, User Defined Functions (UDFs), and Triggers.

The following comment styles are supported.

  • Single-line comments: A single-line comment can start anywhere on a line with a #, //, or -- and extends to the end of the line.

  • Multi-line comments: A multi-line comment can start with a /* at the beginning of a line and ends with */.

    NOTE: /* and */ can be used on the same line for single-line comments.

Example

/* Remove any existing table with the name Hockey_Player */
DROP TABLE IF EXISTS Hockey_Player;

SELECT * FROM Hockey_Player;

/*  Create a new table named Hockey_Player.
The table has the following columns:
ID, name, address, city, zip code,
team ID, gender, and phone number. */

CREATE TABLE Hockey_Player
(id        BIGINT      GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
 name      STRING      NOT NULL, --name of the team
 address   STRING      NULL, // address of the player
 city      STRING      NOT NULL,
 zip_code  STRING      NOT NULL,
 teamid    VARCHAR(3)  DEFAULT 'BOS',
 gender    CHAR(1)     CHECK (gender IN ('M','F') ), # gender of the hockey player
 phone     STRING      /* The 10 digit phone number of the player */
);

-- Show all the columns of the Hockey_Player table
SELECT * FROM Hockey_Player;