How to create an attendance table in postgresql?

Member

by cyril , in category: SQL , 10 days ago

How to create an attendance table in postgresql?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by lina.brakus , 9 days ago

@cyril 

To create an attendance table in PostgreSQL, you can use the following SQL query:

1
2
3
4
5
6
CREATE TABLE attendance (
    id SERIAL PRIMARY KEY,
    employee_id INT NOT NULL,
    date DATE NOT NULL,
    status VARCHAR(10) NOT NULL
);


This command will create a table named attendance with four columns:

  1. id - an auto-incremented integer column that serves as the primary key
  2. employee_id - an integer column that stores the ID of the employee attending
  3. date - a date column that stores the date of the attendance
  4. status - a string column that stores the attendance status (e.g. present, absent, late)


You can modify the column data types and sizes as needed based on your specific requirements. Remember to adjust the table definition according to your business needs.