180k views
3 votes
Create a new table named EMPLOYEES with four columns: Emp#, Lastname, Firstname, and Job_class. The Job_class column should be able to store character strings up to a maximum length of four, without padding the values if they have less than four characters. The Emp# column should allow a five-digit number. Determine suitable column sizes for the Firstname and Lastname columns.

User Kyte
by
8.3k points

1 Answer

3 votes

Final Answer:

Here are the suitable column sizes for the EMPLOYEES table:

Emphash: INT (5)

Lastname: VAR-CHAR (30)

Firstname: VAR-CHAR (20)

Job_class: CHAR (4)

Step-by-step explanation:

Emphash:

We need a data type that can store five-digit numbers.

INT (5) is a suitable data type that can store integers between -32768 and 32767, which is sufficient for five-digit numbers.

Lastname:

Since last names can vary in length, we need a string data type.

VAR-CHAR is a variable-length string data type, which means it stores only the actual characters entered, without padding with spaces.

Most last names are shorter than 30 characters, making VAR-CHAR (30) a suitable choice for this column.

Firstname:

Similar to last names, first names also vary in length and require a string data type.

VAR-CHAR is appropriate for storing first names as well.

Considering the average length of first names, VAR-CHAR (20) should be sufficient.

Job_class:

We know that Job_class stores character strings up to a maximum length of four.

CHAR is a fixed-length string data type that stores the specified number of characters, regardless of the actual length of the data.

CHAR (4) ensures that Job_class values have a maximum length of four characters while minimizing storage space compared to a larger data type like VAR-CHAR (4).

These recommended data types provide an efficient and optimal solution for the EMPLOYEES table based on the specified requirements.

Note: Instead of using its symbol, hash is return. Because of issue is uploading.

User Bravado
by
7.6k points