Skip to content

Army Biz-Scenario #43

Open
moshefidds wants to merge 4 commits into
CPU-Code-School:mainfrom
moshefidds:main
Open

Army Biz-Scenario #43
moshefidds wants to merge 4 commits into
CPU-Code-School:mainfrom
moshefidds:main

Conversation

@moshefidds
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work! See comments, fix and resubmit.

Comment thread 2 table.sql
constraint c_Soldiers_Soldier_First_Name_cannot_be_blank check (SoldierFirstName <> ''),
SoldierLastName varchar(30) not null
constraint c_Soldiers_Soldier_Last_Name_cannot_be_blank check (SoldierLastName <> ''),
SSN char(10) not null
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a much easier way to do this constraint. Use like.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to like

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use SSN like [1-9][0-9]...

Comment thread 2 table.sql Outdated
and substring(SSN, 10, 1) between 0 and 9)
constraint u_Soldiers_SSN unique,
DOB date not null,
PlaceOfResidence varchar(30) not null,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't allow blank.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Comment thread 2 table.sql Outdated
ServiceUnit varchar(30) not null
constraint c_Soldiers_Service_Unit_must_be_either_ground_land_or_air
check (ServiceUnit like '%Air%' or ServiceUnit like '%Ground%' or ServiceUnit like'%Navy%'),
UnitRank varchar(50) not null,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't allow blank.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Comment thread 2 table.sql Outdated
constraint c_Soldiers_Service_Unit_must_be_either_ground_land_or_air
check (ServiceUnit like '%Air%' or ServiceUnit like '%Ground%' or ServiceUnit like'%Navy%'),
UnitRank varchar(50) not null,
IQlevel tinyint not null,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't allow 0 or negative.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment thread 2 table.sql Outdated
constraint u_Soldiers_SSN unique,
DOB date not null,
PlaceOfResidence varchar(30) not null,
DateOfEnlistment date not null,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't allow future date.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Comment thread 3 data.sql
@@ -0,0 +1,12 @@
use ArmyDB
go
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't run file multiple times.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added delete

Comment thread 4 reports.sql Outdated
order by s.IQlevel desc

--2) I need a list of all soldiers sorted by age at enlistment from high to low. Do not include columns that are not relevant to this list.
select s.DOB, s.DateOfEnlistment, Age = datediff(year,s.DOB,s.DateOfEnlistment)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Show the names etc. The things not relevant are IQ level, place of residence, unit etc.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added relevant columns

Copy link
Copy Markdown
Author

@moshefidds moshefidds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated requested corrections
Thanks

Comment thread 3 data.sql
@@ -0,0 +1,12 @@
use ArmyDB
go
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added delete

Comment thread 2 table.sql
constraint c_Soldiers_Soldier_First_Name_cannot_be_blank check (SoldierFirstName <> ''),
SoldierLastName varchar(30) not null
constraint c_Soldiers_Soldier_Last_Name_cannot_be_blank check (SoldierLastName <> ''),
SSN char(10) not null
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to like

Comment thread 2 table.sql Outdated
and substring(SSN, 10, 1) between 0 and 9)
constraint u_Soldiers_SSN unique,
DOB date not null,
PlaceOfResidence varchar(30) not null,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Comment thread 2 table.sql Outdated
constraint u_Soldiers_SSN unique,
DOB date not null,
PlaceOfResidence varchar(30) not null,
DateOfEnlistment date not null,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Comment thread 2 table.sql Outdated
ServiceUnit varchar(30) not null
constraint c_Soldiers_Service_Unit_must_be_either_ground_land_or_air
check (ServiceUnit like '%Air%' or ServiceUnit like '%Ground%' or ServiceUnit like'%Navy%'),
UnitRank varchar(50) not null,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Comment thread 2 table.sql Outdated
constraint c_Soldiers_Service_Unit_must_be_either_ground_land_or_air
check (ServiceUnit like '%Air%' or ServiceUnit like '%Ground%' or ServiceUnit like'%Navy%'),
UnitRank varchar(50) not null,
IQlevel tinyint not null,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment thread 4 reports.sql Outdated
order by s.IQlevel desc

--2) I need a list of all soldiers sorted by age at enlistment from high to low. Do not include columns that are not relevant to this list.
select s.DOB, s.DateOfEnlistment, Age = datediff(year,s.DOB,s.DateOfEnlistment)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added relevant columns

Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! 100% All good.

Comment thread 2 table.sql
constraint c_Soldiers_Soldier_First_Name_cannot_be_blank check (SoldierFirstName <> ''),
SoldierLastName varchar(30) not null
constraint c_Soldiers_Soldier_Last_Name_cannot_be_blank check (SoldierLastName <> ''),
SSN char(10) not null
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use SSN like [1-9][0-9]...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant