Page 64 - 2611_SmartGPT Pro V(5.0) C-8
P. 64

The MySQL prompt appears, allowing queries to be performed on the MySQL server.























                            SQL DATA TYPES


                  A data  type  defines  the  type  of value that  a column  will contain.  In  a database  table,  every
                  column must have a name and a data type. Some common SQL data types and their descriptions
                  listed below:


                      Data Type                      Description                                 Example


                                       Stores whole numbers (no decimals).           age INT;
                   INTEGER(INT)
                                                                                     Example: 25, 30
                                       Stores  fixed-length character  strings  of  gender CHAR(1);
                   CHAR(n)
                                       size n.                                       Example: ‘M’, ‘F’
                                       Stores  variable-length character strings  name VARCHAR(50);
                   VARCHAR(n)
                                       with a maximum size of n.                     Example: ‘Yash Gupta’, ‘Sonia’

                                       Stores  numbers  with  precision  p  and  price DECIMAL(5,2);
                   DECIMAL(p,s)
                                       scale s.                                      Example: 123.45, 99.99
                                       Stores  date values in YYYY-MM-DD  birthdate DATE;
                   DATE
                                       format.                                       Example: ‘1990-05-25’
                                       Stores   floating-point    numbers     with temperature FLOAT(5);
                   FLOAT(p)
                                       precision p.                                  Example: 98.6, 35.75
                                       Stores time values in HH:MM:SS format.        appointment_time TIME;
                   TIME
                                                                                     Example: ‘10:30:00’, ‘15:45:00’
                                       Stores date and time values in YYYY-MM- created_at TIMESTAMP;
                   TIMESTAMP           DD HH:MM:SS format.                           Example:           ‘2025-07-10
                                                                                    14:30:00’
                                       Stores TRUE or FALSE values.                  is_active BOOLEAN;
                   BOOLEAN
                                                                                     Example: TRUE, FALSE








                   62   Computer Science (V5.0)-VIII
   59   60   61   62   63   64   65   66   67   68   69