EBK CONCEPTS OF DATABASE MANAGEMENT
EBK CONCEPTS OF DATABASE MANAGEMENT
8th Edition
ISBN: 9780100706002
Author: Last
Publisher: YUZU
Question
Book Icon
Chapter 3, Problem 1RQ
To determine

To describe the process of creating a table in SQL and a list of different data types used for fields.

Expert Solution & Answer
Check Mark

Explanation of Solution

In SQL CREATE TABLE command is used for making the table, and to describe its layout.

The syntax for creating the table:

CREATE TABLE table_name (column1 datatype, …., column n datatype);

For example, following command will create an employee table with two fields EmployeeID and EmployeeName.

CREATE TABLE Employee (EmployeeId int, EmployeeName varchar (10));

Rules for naming tables and columns in SQL vary slightly from one version of SQL to another version. Some common rules for naming tables and columns in DBMS are as follows:

• The names should not contain more than18 characters.

• Names must start with a letter.

• Names can only contain letters, numbers, and underscores ().

• it does not contain spaces.

List of data types used for field:

  1. Integer: it stores an integer, i.e., the number without decimal part. The valid data range for integer is −2147483648 to 2147483647. There is no need to specify the length of an integer.
  2. Smallint: it Stores integers but it, uses less storage space than the integer data type. The valid data range is −32768 to 32767. Sometimes, smallint is a better choice than integer when we have a certain field that will store numbers within the indicated range.
  3. Decimal (a, b): It stores a decimal number having a number of places before decimal and bnumber of places after decimal. For example, decimal (6,2) represents a six-digit number with three places to the left and two places to the right of the decimal. Most commonly, decimals, are used to represent either the currency or the number data type.
  4. Char(n): it Stores a character string, which is n characters long. The value for n must be an integer.
  5. Date: it Stores dates in the form DD-MON-YYYY or MM/DD/YYYY. For example, May 12, 2019, could be stored as 12-MAY-2019 or 5/12/2019.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY