Discussion Forum Unit 4 PDF

Title Discussion Forum Unit 4
Author Mohammad Dar
Course Databases 1
Institution University of the People
Pages 2
File Size 106.6 KB
File Type PDF
Total Views 138

Summary

university of the people CS2203 - Discussion Forum Unit 4...


Description

Data types are used to represent the nature of the data that can be stored in the database table.(Javapoint, n.d). For a database to be unique, each and every attribute must have a data type specified for those values. Each column, variable, and expression has a related data type in SQL. The database developer can use these data types while creating tables in a database, the database developer can choose a data type for a table column based on their requirement. (Tutorialspoint, n.d). CHAR and VARCHAR are both ASCII character data types and almost the same but they are different at the stage of storing and retrieving the data from the database. (Tutorialspoint, n.d). Here are some main differences that can found between char and varchar in a SQL Database:

Number Data Types: For the numeric data type in SQL database, it all depends on the size (byte size) of the data you want to store in that particular attribute as well the type of data you want to store.

Integers data type: Bit- The number of bits per value is specified in size. The size parameter can hold a value from 1 to 64. The default value for size is 1. (w3schools.com, n. d). Smallint- Signed range is from -32768 to 32767. Unsigned range is from 0 to 65535. The size parameter specifies the maximum display width (which is 255). (w3schools.com, n. d). Bigint- Signed range is from -9223372036854775808 to 9223372036854775807. Unsigned range is from 0 to 18446744073709551615. (w3schools.com, n. d). Int- Signed range is from -2147483648 to 2147483647. Unsigned range is from 0 to 4294967295. The size parameter specifies the maximum display width (which is 255). (w3schools.com, n. d).

Tinyint- A very small integer. Signed range is from -128 to 127. Unsigned range is from 0 to 255. The size parameter specifies the maximum display width (which is 255). (w3schools.com, n. d).

Decimal Data Types: Decimal(p,s) – takes values from -10^38 +1 to 10^38 –1 and stores 5-17 bytes (w3schools.com, n. d). “The p parameter is for the maximum total number of digits that can be stored from left and to right before the decimal point, where p is any value from 1 to 38 with a default of 18” (w3schools.com, n. d). “The s parameter is for the maximum number of digits stored to the right after the decimal point (s any value from 0 to p) with a default value of 0” (w3schools.com, n. d).

Float data type: · float(n) – “Floating precision number data from -1.79E + 308 to 1.79E + 308 and stores 4 or 8 bytes “(w3schools.com, n. d). “The n parameter sp;2ecifies whether the field should hold 4 or 8 bytes” (w3schools.com, n. d). “Float (24) holds a 4-byte field, and float (53) holds an 8-byte field of which the default value of n is 53” (w3schools.com, n. d). · Real – “Floating precision number data from -3.40E + 38 to 3.40E + 38 and stores 4 bytes only” (w3schools.com, n. d)

References: SQL Data Types for MySQL, SQL Server, and MS Access. (n.d.). W3schools. https://www.w3schools.com/sql/sql_datatypes.asp SQL - Data Types - Tutorialspoint. (n.d.). Tutorialspoint. https://www.tutorialspoint.com/sql/sql-data-types.htm SQL Data Types - javatpoint. (n.d.). Www.Javatpoint.Com. https://www.javatpoint.com/sql-data-types...


Similar Free PDFs