O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

Here is an example of a command that creates the traffic_unit table in PostgreSQL:

CREATE TABLE traffic_unit (  id SERIAL PRIMARY KEY,  vehicle_type VARCHAR NOT NULL,  horse_power integer NOT NULL,  weight_pounds integer NOT NULL,  payload_pounds integer NOT NULL,  passengers_count integer NOT NULL,  speed_limit_mph double precision NOT NULL,  traction double precision NOT NULL,  road_condition VARCHAR NOT NULL,  tire_condition VARCHAR NOT NULL,  temperature integer NOT NULL);

Here, we did not set the size of the columns of the type VARCHAR, thus allowing those columns to store values of any length. The integer type, in this case, allows you to store numbers from -2147483648 to +2147483647. The NOT NULL type was added because, by default, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required