Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I almost done witm my assignment, but i coudn't figure the last query out. here is what is rquired. (this assignment has to be done

I almost done witm my assignment, but i coudn't figure the last query out. here is what is rquired. (this assignment has to be done by pgadmin4)

Add country, salary column to city table and set yearly_salary to 78246.12 for cities in Canada. DEFAULT constraint must be used to add Canada as a default country for cities. [Use DEFAULT Constraint to default your country to Canada, that way you only have to write the countries for cities which are not in Canada, Hint : remember boston and new York are cities in US, rest all are in Canada, Use ALTER TABLE to add column and default constraint].

image text in transcribed

image text in transcribed

image text in transcribed

1. Answer the questions with respect to the table below users id gender city_id name John Sara Victor Jane age 25 20 31 27 OCC I 4 occupation id name Software Engineer Accountant Pharmachist Library Assistant 4 city id name Halifax Calgary Boston New York Toronto (a) Create the three tables with their SQL queries and paste the code in text format below. Make sure while creating the tables: [6+2+2] .Must have primary keys in all the tables .The attributes which can potentially be foreign keys must have NOT NULL Constraint. Gender attribute in users table should CHECK for 'M' or 'F

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions