Not null char type column : Char « Data Type « SQL / MySQL






Not null char type column

      
mysql>
mysql> CREATE TABLE HeadOfState
    -> (
    ->     ID          INT NOT NULL,
    ->     LastName    CHAR(30) NOT NULL,
    ->     FirstName   CHAR(30) NOT NULL,
    ->     CountryCode CHAR(3) NOT NULL
    -> );
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> DESCRIBE HeadOfState;
+-------------+----------+------+-----+---------+-------+
| Field       | Type     | Null | Key | Default | Extra |
+-------------+----------+------+-----+---------+-------+
| ID          | int(11)  | NO   |     | NULL    |       |
| LastName    | char(30) | NO   |     | NULL    |       |
| FirstName   | char(30) | NO   |     | NULL    |       |
| CountryCode | char(3)  | NO   |     | NULL    |       |
+-------------+----------+------+-----+---------+-------+
4 rows in set (0.00 sec)

mysql>
mysql> drop table HeadOfState;
Query OK, 0 rows affected (0.00 sec)

mysql>

   
    
    
    
    
    
  








Related examples in the same category

1.CHAR(n): character string with specified length
2.Quoting a string value
3.The CHAR data type is a fixed-length character data type that can store up to 255 characters.
4.Add zero to the values to force a string-to-number conversion
5.Writing Strings That Include Quotes or Special Characters
6.To include a quote character within a string that is quoted by the same kind of quote,
7.Testing String Equality or Relative Ordering
8.To find out whether a string lies within a given range of values (inclusive)
9.If you are comparing strings and numerics, or floating-point numbers and integers, MySQL will compare them as
10.Not equal char type value
11.Max with char type values
12.Compare char type value