0% found this document useful (0 votes)
11 views2 pages

Day - 3 - SQL - Creating Database and Tablein SQL

The document provides a lesson on creating a database and table in SQL as part of a 30-day program. It includes SQL code for creating a 'company' database and an 'employee' table with five columns: employee_id, name, position, department, hire_date, and salary. This lesson is focused on PostgreSQL syntax for database creation.

Uploaded by

infinity7702
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Day - 3 - SQL - Creating Database and Tablein SQL

The document provides a lesson on creating a database and table in SQL as part of a 30-day program. It includes SQL code for creating a 'company' database and an 'employee' table with five columns: employee_id, name, position, department, hire_date, and salary. This lesson is focused on PostgreSQL syntax for database creation.

Uploaded by

infinity7702
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Day 3 :

Learn to Create Database


and Table in SQL

"30 Days, 30 Lessons: Unlock


the Power of SQL!"
Here is the SQL code to create a company database and an employee
table with five relevant columns in PostgreSQL:

1. Create the Database:


CREATE DATABASE company;

2. Create the Employee Table:


CREATE TABLE employee (
employee_id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
position VARCHAR(50),
department VARCHAR(50),
hire_date DATE,
salary NUMERIC(10, 2)
);

You might also like