I need help with 1-3. I understand what code I need to write but I am unsure how
ID: 3916045 • Letter: I
Question
I need help with 1-3. I understand what code I need to write but I am unsure how to do the setup. Do I need to download a database? If someone could give me a step by step from opening sql servermanagement studio to completion I would really appreciate it. So far when I write the following code in a new query I get the following error.
Code:
CREATE TABLE CUSTOMER(
CUST_NUM NUMBER(20) PRIMARY KEY,
CUST_LNAME VARCHAR(20),
CUST_FNAME VARCHAR(20),
CUST_BALANCE NUMBER(9,2));
Error:
Msg 2715, Level 16, State 6, Line 1
Column, parameter, or variable #1: Cannot find data type NUMBER.
Explanation / Answer
there is no data type called NUMBER , but its NUMERIC(p,s)
numeric(p,s) Fixed precision and scale numbers.
Allows numbers from -10^38 +1 to 10^38 –1.
The p parameter indicates the maximum total number of digits that can be stored (both to the left and to the right of the decimal point). p must be a value from 1 to 38. Default is 18.
The s parameter indicates the maximum number of digits stored to the right of the decimal point. s must be a value from 0 to p. Default value is 0
so your code will be like
CREATE TABLE CUSTOMER(
CUST_NUM NUMERIC(20) PRIMARY KEY,
CUST_LNAME VARCHAR(20),
CUST_FNAME VARCHAR(20),
CUST_BALANCE NUMERIC(9,2));
Thanks
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.