Sunday, 8 November 2015

The basic elements of SQL with MySQL implementations include statements, names, data types, constants, expressions and innate function.

The basic elements of SQL with MySQL implementations include statements, names, data types, constants, expressions and innate function. | Problem Solving in Mysql Education
After knowing the history of MySQL, now we are to the base in mysql.
Do you know about the basic elements that exist in mysql?
Answer :

1.   Statement
      Command of SQL is used to request an action to the DBMS. Basic SQL statements, among        others:
STATEMENT
DESCRIPTION
ALTER
Changing the table structure
COMMIT
Ending the execution of the transaction
CREATE
Create table, indexes
DELETE
Deletes the rows in a table
DROP
Deletes table, index
GRANT
Assigning rights to the database to the user
INSERT
Adding rows in the table
REVOKE
Cancel the rights to the database
ROLLBACK
Restoring the original state if the transaction fails to be implemented
SELECT
Select the rows and columns in a table
UPDATE
Change the value in a table row
  
   

  2.  Name
     Names used as identifiers, namely the identity of the object in the DBMS. For example: tables,            columns and users.

3.  Data types
           in MySQL :
a.       For numeric data types:
Type
Description
Range Value
TINYINT
Integer values are very small
Signed : -128 to 127 unsigned : 0 to 255
SMALLINT
Small integer value
Signed :-32768 to 32767 unsigned : 0 to 65535
MEDIUMINT
Medium integer value
Signed : -8388608 to 8388607 unsigned : 0 to 16777215
INT
Integer nteger with default values
Signed : -2147483648 to 2147483647 Unsigned: 0 to 4294967295
BIGINT
Integer with great value
Signed: -9223372036854775808 to 9223372036854775807 Unsigned: 0 to 18446744073709551615

FLOAT
decimal Numbers with single-precission
minimum ± 1.175494351e-38 maksimum  ± 3.402823466e + 38

DOUBLE
decimal Numbers with double-precission
minimum ±2.2205738585072014e-308
maksimum ±1.7976931348623457e + 308

DECIMAL (M, D)
Numbers float (decimal) are expressed as a string. M is the number of digits stored in a column, N is the number of digits after the decimal
Depending on the value of the M and D


Description: Signed and Unsigned is an attribute for numeric data types
- Signed: data stored in a column of data can be negative and positive.
- Unsigned: used so that the data entered is not negative data (> = 0). Float data type can not be declared with unsigned.

b.      String data type:
Type
Description
Maximum size
CHAR (n)
String of characters with a fixed length
1 M byte
VARCHAR(n)
String character length is not fixed, the maximum n
1 M byte
TINYBLOB BLOB
Binary Large Object is very small
28-1 byte
BLOB
BLOB small size
216-1 byte
MEDIUMBLOB
BLOB sized
224-1 byte
LONGBLOB
large BLOB
232-1 bytes
TINYTEXT
very small text String
28-1 bytes
TEXT
small text string
216-1 bytes
MEDIUMTEXT
medium sized text string (medium)
224-1 bytes
LONGTEXT
large text string
232-1 bytes
Enumeration ENUM
the column can be filled with an enumeration member
65535 members
SET The set
the column can be filled with some members of the set value
64 members of the set


c.       Date and time data types:
Type
Range
Format
DATE
“1000-01-01” to “9999-12-31”
“0000-00-00”
TIME
“-832:59:59” to “838:59:59”
“00:00:00”
DATETIME
“1000-01-01 00:00:00” to
“9999-12-31 23:59:59”
“0000-00-00 00:00:00”

      4.  Constant
      A fixed value

       5.    Expression
       Expression is used to generate / calculate the value. For example: number = price-discount
      Arithmetic expressions, among others:
a.       +: plus
b.      -: less
c.       /: for
d.      *: times

implementation


References :

No comments:

Post a Comment