Step 4: defining the database schema
The VMart database installs with sample scripts with SQL commands that are intended to represent queries that might be used in a real business.
The VMart database installs with sample scripts with SQL commands that are intended to represent queries that might be used in a real business. The vmart_define_schema.sql
script runs a script that defines the VMart schema and creates tables. You must run this script before you load data into the VMart database.
This script performs the following tasks:
-
Defines two schemas in the VMart database schema: online_sales and store.
-
Defines tables in both schemas.
-
Defines constraints on those tables.
Vmart=> \i vmart_define_schema.sql
CREATE SCHEMA
CREATE SCHEMA
CREATE TABLE
CREATE TABLE
CREATE TABLE
CREATE TABLE
CREATE TABLE
CREATE TABLE
CREATE TABLE
CREATE TABLE
CREATE TABLE
ALTER TABLE
CREATE TABLE
CREATE TABLE
ALTER TABLE
CREATE TABLE
ALTER TABLE
CREATE TABLE
CREATE TABLE
CREATE TABLE
ALTER TABLE