Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SQL Table I have a bug in this code veggieID : Int // the key for this table day

ID: 3773793 • Letter: S

Question

SQL Table

I have a bug in this code

veggieID : Int   // the key for this table

daysToHarvest : Int Check < 80 ( a required check in the table)

watering : Decimal(4,2) is the estimated total water needed for a unit of planting area,

Check <120.00

All entries in the table are required, no nulls allowed.

Database : MyGarden // use whatever name you wish

Table 1. VeggiePropertiesRR( veggieID, veggieName, variety, plantingSeason, daysToHarvest, watering)

Use the data supplied in the table below

VeggiePropertiesRR

CREATE TABLE VeggiePropertiesRR
(
veggieID int NOT NULL,
veggieName varchar(27) NOT NULL,
variety varchar(27) NOT NULL,
plantingSeason varchar(27) NOT NULL,
daysToHarvest int,
watering DECIMAL(4,2),
CONSTRAINT chk_VeggiePropertiesRR CHECK (daysToHarvest<80 AND watering<120.00)
)

veggieID

name

variety

season

daysToHarvest

watering (inch/week)

1

carrot

Nantes

winter

60

0.8

2

tomato

Beefsteak

spring

79

1.1

3

cucumber

Marketmore 76

summer

68

0.8

4

squash

Straightneck

spring

54

1

5

carrot

Danvers

winter

75

1

6

peas

Sugar Daddy

fall

62

1.2

7

spinach

Hierloom

fall

45

1.25

8

cucumber

Cocozelle

summer

55

0.8

9

spinach

Bloomsdale

fall

36

1.25

10

tomato

Sweetie

spring

70

1.1

11

tomato

Jelly Bean

spring

70

1.1

12

carrot

Imperator

winter

77

1

13

cucumber

national

spring

55

0.8

14

tomato

Red Cherry

spring

70

1.1

15

peas

Alaska

fall

55

1.2

16

pumpkin

Conneticut

summer

79

1

veggieID

name

variety

season

daysToHarvest

watering (inch/week)

1

carrot

Nantes

winter

60

0.8

2

tomato

Beefsteak

spring

79

1.1

3

cucumber

Marketmore 76

summer

68

0.8

4

squash

Straightneck

spring

54

1

5

carrot

Danvers

winter

75

1

6

peas

Sugar Daddy

fall

62

1.2

7

spinach

Hierloom

fall

45

1.25

8

cucumber

Cocozelle

summer

55

0.8

9

spinach

Bloomsdale

fall

36

1.25

10

tomato

Sweetie

spring

70

1.1

11

tomato

Jelly Bean

spring

70

1.1

12

carrot

Imperator

winter

77

1

13

cucumber

national

spring

55

0.8

14

tomato

Red Cherry

spring

70

1.1

15

peas

Alaska

fall

55

1.2

16

pumpkin

Conneticut

summer

79

1

Explanation / Answer

You need to provide some more details here. If you are asking if the sql query is right then yes it is. But as with the description provided, you need to add some more constraints in the query. Here is the complete one:

CREATE TABLE VeggiePropertiesRR
(
veggieID int PRIMARY KEY,
veggieName varchar(27) NOT NULL,
variety varchar(27) NOT NULL,
plantingSeason varchar(27) NOT NULL,
daysToHarvest int NOT NULL,
watering DECIMAL(4,2) NOT NULL,
CONSTRAINT chk_VeggiePropertiesRR CHECK (daysToHarvest<80 AND watering<120.00)
)

I have added primary key and Not Null constraints also. Keep in mind primary key is already not null by default so no need to mention twice.