0

I want to put some special constraints over my values in the next table:

CREATE TABLE MyTable
{
  id varchar(100) NOT NULL PRIMARY KEY,

  first_special varchar(8), <- I want it to have max of 8 symbols with no spaces in it

  second_special float  <- I want it to have precision of 2 decimal points after the '.'
}

EDIT:

The platform is Microsoft SQL Server.

1
  • Don't use float (or double or something similar). Those approximate types and what you store there is not necessarily the same that you retrieve later. Use numeric or number or whatever the name in your DBMS is. Commented Jul 10, 2014 at 17:19

1 Answer 1

1

In Oracle (and I think in all dbs) the second one is easy.

second_special NUMBER(5,2) -- The max number would be 999.99
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.