Question: -- 1) Creating the table student

```
CREATE TABLE student (IDNO VARCHAR(11) NOT NULL PRIMARY KEY,
                      NAME VARCHAR(64) NOT NULL,
                      ROOM INTEGER,
                      HOSTEL CHAR(2),
                      CGPA NUMERIC (2,2) CHECK(CGPA < 10 and CGPA > 0));

```

-- Inserting the given data CGPA DECIMAL(2,2) CHECK(CGPA < 10 and CGPA > 0)

```
INSERT INTO student VALUES('2000A3PS177', 'Raoul', 222, 'AK', 8.8);

INSERT INTO student VALUES('2001A7PS098', 'Kapil', 143, 'RM', 7.9);

INSERT INTO student VALUES('2000A7PS588', 'Sriram', 175, 'RP', 10.0);

INSERT INTO student VALUES('2001A7PS721', 'Nikhil', 112, 'RM', 9.2);

INSERT INTO student VALUES('2001A3PS588', 'Mouli', 121, 'BD', 7.5);

```

I have above code when i run get the below error:
Preparing...
Importing my\_test.sql...
Finished executing script
**ERROR 1264 (22003) at line 8: Out of range value for column 'CGPA' at row 1**
Operation failed with exitcode 1

I have tried changing the value which i have entered or NUMERIC to DECIMAL but no luck.

If i make below change it is working.
form

```
CGPA NUMERIC (2,2) CHECK(CGPA < 10 and CGPA > 0)

```

to 

```
CGPA float 

```

Can you please help to understand what i am missing here ?

Answer: 
Your problem is `NUMERIC(2, 2)`. This basically supports values from `0.00` to `0.99` -- two digits of precision.

I think you intend `NUMERIC(4, 2)` or `NUMERIC(3, 2)` in order to support digits *before* the decimal point.
**Also In Addition to ans to understand the concept below is helpful:**

The DDL would look like this:
CREATE TABLE account (
accountNo integer,
balance numeric(8,2)
);

The “balance” column can safely store the number 173226.62.
[![enter image description here](https://i.stack.imgur.com/OcB8r.jpg)](https://i.stack.imgur.com/OcB8r.jpg)

Numerical, decimal Data Types in SQL

P- 8 (This is total decimal digit)
S- 2