db2 schema sample
时间: 2023-10-05 21:10:15 浏览: 34
Here is an example of creating a schema in IBM DB2:
```
CREATE SCHEMA employee AUTHORIZATION db2admin;
```
This statement creates a new schema called "employee" and assigns "db2admin" as the owner. You can then create tables, views, and other database objects within the "employee" schema. For example, to create a table called "employees" within the "employee" schema:
```
CREATE TABLE employee.employees (
emp_id INT NOT NULL,
emp_name VARCHAR(50) NOT NULL,
emp_salary DECIMAL(10,2),
PRIMARY KEY (emp_id)
);
```
This statement creates a table called "employees" within the "employee" schema, with columns for employee ID, name, and salary. The primary key is defined on the "emp_id" column.