postgresql create table with boolean column 1

postgresql create table with boolean column

CREATE TABLE stock_availability (
   product_id INT PRIMARY KEY,
   available BOOLEAN NOT NULL
);

Here is what the above code is Doing:
1. We’re creating a table called stock_availability.
2. We’re giving it two columns: product_id and available.
3. We’re making product_id the primary key.
4. We’re making available a boolean column that can’t be null.

Now that we have a table, let’s add some data to it.

Similar Posts