Skip to content

FLOAT4

CREATE TABLE items (
id SERIAL PRIMARY KEY,
product VARCHAR(100),
weight FLOAT4
);
INSERT INTO items (product, weight) VALUES ('Apple', 0.12), ('Banana', 0.15);
SELECT * FROM items;
id | product | weight
----|---------|--------
1 | Apple | 0.12
2 | Banana | 0.15

This sample SQL code creates a table named items with three columns: id, product and weight. The weight column uses the FLOAT4 data type to store floating-point numbers. Two rows are inserted into the items table, and then all records from the table are selected with a SELECT * FROM items command. The output shows the results of this select query.