diff --git a/0 database.sql b/0 database.sql new file mode 100644 index 0000000..f86de14 --- /dev/null +++ b/0 database.sql @@ -0,0 +1,7 @@ +use master +go +drop database if exists ArmyDB +go +create database ArmyDB +go + diff --git a/1 table.sql b/1 table.sql new file mode 100644 index 0000000..377f5d8 --- /dev/null +++ b/1 table.sql @@ -0,0 +1,20 @@ +use ArmyDB +go +drop table if exists dbo.Soldier +go +create table dbo.Soldier( + SoldierID int not null identity primary key, + FirstName varchar(25) not null constraint ck_Soldier_first_name_cannot_be_blank check(FirstName <> ''), + LastName varchar(25) not null constraint ck_Soldier_last_name_cannot_be_blank check(LastName <> ''), + SSN char(10) not null constraint ck_Soldier_SSN_cannot_exceed_10_digits_and_cannot_have_letters check(SSN like ('[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9]')), + DOB date not null, + PlaceOfResidence varchar(40) not null constraint ck_Soldier_place_of_residence_cannot_be_blank check(PlaceOfResidence <> ''), + DateEnlisted date not null + constraint ck_Soldier_date_enlisted_cannot_be_a_future_date check(DateEnlisted <= getdate()), + ServiceUnit varchar(15) not null + constraint ck_Soldier_service_unit_must_be_air_force_navy_or_ground_force check(ServiceUnit in('Air Force', 'Ground Force', 'Navy')), + Rank varchar(90) not null constraint ck_Soldier_rank_cannot_be_blank check(Rank <> ''), + IQLevel int not null constraint ck_Soldier_IQ_level_must_be_greater_than_0 check(IQLevel > 0), + constraint ck_Soldier_must_be_at_least_17_when_enlisted check(datediff(year, DOB, DateEnlisted) >= 17) +) +go \ No newline at end of file diff --git a/2 data.sql b/2 data.sql new file mode 100644 index 0000000..8cc3473 --- /dev/null +++ b/2 data.sql @@ -0,0 +1,12 @@ +use ArmyDB +go + +delete Soldier +insert Soldier(FirstName, LastName, SSN, DOB, PlaceOfResidence, DateEnlisted, ServiceUnit, Rank, IQLevel) +select 'Ron', 'Aviad', '54876373-2', '01/01/2000', 'Caesarea', '01/03/2021', 'Air Force', 'sergeant', 95 +union select 'Shachar', 'Dotan', '85274136-9', '08/16/2001', 'Jerusalem', '10/01/2020', 'Navy', 'lieutenant colonel', 111 +union select 'Osher', 'Sharon', '95135778-2', '05/04/1996', 'Tel-Aviv', '04/01/2017', 'Ground Force', 'sergeant', 79 +union select 'Yoni', 'Tamari', '24863570-5', '11/23/1999', 'Jerusalem', '12/01/2018', 'Air Force', 'lieutenant general', 139 +union select 'Shai', 'Ben Zeev', '93185378-1', '09/13/2001', 'Netanya', '01/01/2020', 'Air Force', 'sergeant', 120 +union select 'Dory', 'Lavie', '16834952-7', '10/28/2004', 'Haifa', '12/01/2021', 'Navy', 'brigadier general', 118 + diff --git a/3 reports.sql b/3 reports.sql new file mode 100644 index 0000000..ed4724c --- /dev/null +++ b/3 reports.sql @@ -0,0 +1,25 @@ + +--1) Show a list of all soldiers with all details sorted by IQ level from high to low. +select * +from Soldier s +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 AgeAtEnlistment = datediff(year, s.DOB, s.DateEnlisted), s.LastName +from Soldier s +order by AgeAtEnlistment desc + +/* 3) Following an upward trend in recruitment since the outbreak of Covid, I need data on recruitment between the years 2017-2019 compared to the years 2020-2022. +The format should be as follows :Year Range (2017-2019/2020-2022), First Name Last Name - SSN (date of enlistment), service unit. +(This should be done by using a union select and adding a literal column for year range.) */ +select YearRange = +case + when year(s.DateEnlisted) between 2017 and 2019 then '2017-2019' + when year(s.DateEnlisted) between 2020 and 2022 then '2020-2022' +end +, SoldierInfo = concat(s.FirstName, ' ', s.LastName, ' - ', s.SSN, ' (', s.DateEnlisted, '), ',s.ServiceUnit) +from Soldier s +--4) I need to know what the average IQ level is for soldiers per service unit. +select AvgIQ = avg(s.IQLevel), s.ServiceUnit +from Soldier s +group by s.ServiceUnit diff --git a/README.md b/README.md deleted file mode 100644 index 2cb09fe..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -## CPU Code School Session 20: -#### Approved business scenarios of previous students are listed above. -#### Pick one and get coding! - -#### Good Luck!!! diff --git a/airline.sql b/airline.sql deleted file mode 100644 index 091324f..0000000 --- a/airline.sql +++ /dev/null @@ -1,51 +0,0 @@ -/* -I have an airline called 'Fly Air'. Flights are getting booked, but I can't keep track of how many people I have on each flight and who's flying. - -Each flight has a flight number on each route for each time they leave. -I can have multiple flights a day on the same route, so I would need to keep track of how many people I have booked on each flight. -When you book the flight you would only need to provide your name, DOB and address, but in order to be checked in and travel, we need the passport details. -The details should be provided as: passport number, date of issue, expiry date, and nationality. - -The reports I need are as following: - 1) How many people are booked per flight as: count of people, flight number, departure airport, when the flight is departing and destination. - 2) Who isn't checked in for flights departing in the next week, in order to send them reminders to check in. - 3) How many flights are departing per day, and num of passengers we have on those flights. - 4) How many flights are departing per destination, and num of passengers we have on those flights, to know what route is attracts most people. - 5) How many people booked but didn't actually travel in the end. - 6) How many flights does each person have (to know for frequent flyer status), as: last name, first name, number of flights. - -Question: What's the flight numbers you use? -Answer: We have three letters from our name 'FLY' and then 3 digits starting from 001. - -Question: What age are your passengers? -Answer: The law requires that passengers on our flights must all be adults, so we require they should be at least 16 years old. -We would allow passengers who turned 16 that year. The oldest we allow is 90 for medical reasons. - -Question: What type of passports do your passengers have? -Answer: All passengers that are traveling with us have passport numbers that have 9 digits in it and start with any digit except 0. - -Question: Can you book 2 seats for 1 passenger? -Answer: No, you can only have 1 seat per passenger per flight. - -Question: How old can a passport be in order to travel? -Answer: That depends. If the destination is in same country, the passport just needs to be valid. The same applies if the destination is to the passport's country. -If it's an international flight and not to the passport's country, it can be used up until 9 years and 6 month after it was issued. -But bear in mind that a passport issued to someone before the age of 16 is only valid for 5 years. - -Question: How long before a flight can you book? -Answer: Up to 1 year before the flight, check in opens 30 days before departure. - -Note: Being that the dates are written in UK format, unless you are from the UK paste the following line into your code on top of the data file: -set dateformat dmy -go - -Sample data: - Flight number, Departure Airport, Country, Arrival Airport, Country, Time Departing, Time Arriving, Name, DOB (dd/mm/yyyy), Address, (Passport number, Issue date, Expiry date, Nationality) if provided - FLY001, LHR, UK, JFK, USA, 10/12/2021 8:00AM, 10/12/2021 12:00PM, John Major, 31/12/2000, 22 Queens Road, 175478100, 10/09/2016, 10/09/2026, UK - FLY002, JFK, USA, LHR, UK, 31/12/2021 3:00PM, 01/01/2022 2:30PM, John Major, 31/12/2000, 22 Queens Road - FLY001, LHR, UK, JFK, USA, 12/01/2020 8:00AM, 12/01/2020 12:00PM, Jill Johnson, 12/03/1997, 10 Downing Street, 367654998, 30/01/2019, 25/03/2029, USA - FLY003, LGW, UK, TLV, Israel, 20/01/2022 7:55PM, 21/01/2022 3:00AM, Mike Markowicz, 09/12/1970, 45 Baker Street - FLY004, TLV, Israel, LGW, UK, 09/10/2020 6:40AM, 09/10/2020 9:30AM, Nick Smith, 27/03/1998, 29 London Avenue - FLY004, TLV, Israel, LGW, UK, 09/10/2020 6:40AM, 09/10/2020 9:30AM, John, Smith, 20/10/2004, 29 London Avenue, 209989911, 10/09/2018, 10/09/2023, UK - FLY101, EWR, USA, TLV, Israel, 05/01/2021 9:00AM, 06/01/2021 2:30AM, Jack, Marks, 27/03/1995, 12 Ross Street= -*/ diff --git a/army.sql b/army spec.sql similarity index 100% rename from army.sql rename to army spec.sql diff --git a/cleaning company.sql b/cleaning company.sql deleted file mode 100644 index 06162af..0000000 --- a/cleaning company.sql +++ /dev/null @@ -1,77 +0,0 @@ -/* -First of all thank you for doing this job. I am confident your company is the perfect choice for the work I need to have done. - -I have been running a small cleaning business since January 15, 2017 called Spruce Up. -Recently, due to COVID-19, there have been many changes to keep track of - many have chosen my service to keep the virus from their house. -Unfortunately, a few of my elderly customers have dropped my service because of their fear of letting people potentially carrying the virus into their house. -I feel like I'm now at a point where it's neccessary to store my records electronically so i can keep track of everything in a more orderly and accurate way. - -First of all, I need the first and last names of my customers as well as their phone number and address. -I offer weekly or bi weekly (once every two weeks) cleaning. -I have worked out with each customer a specific rate to charge per hour depending on how cluttered the house is or how hard it is to clean. -I would also like a column for the number of hours I have calculated to be the average time I spend cleaning each house. -In addition I would like a column that computes how much money I earn from each customer at the end of the month. -The other thing I need to include is the date I started working for each customer as well as an end date for those who have chosen to discontinue my cleaning service. - -Question: Did you start cleaning for any of your customers before the official start of your business in 2017? -Answer: I did do a bit of cleaning for friends before then, which is what inspired me to start the business. - None of these people, however, are in my records. I help them out as a friend every now and then for no cost. -Question: What is the highest price you charge for cleans including deep cleans? -Answer: For regular cleans I charge up to $35.00 per hour. - For deep cleans the highest I would ever charge is $53.00 per hour. - For total price it never computes to more than $424.00 even for deep cleans. -Question: Do you have customers in your records more than once if you do other jobs for them? -Answer: Yes we do have a few instances where we do a customer's house as well as their beach house, airb&b, office or rental. - In these cases, the jobs are recorded separately under the customer's name. -Question: What do you want to see in the address? -Answer: All my jobs are local so I only need to know the house number, and street name. -Question: Do you take any time off work? -Answer: Every so often I take a couple days off, but I always add customers to different days - so by the end of the year the weekly customers have 52 services and the bi weekly 26 services. - -Reports: -1) I offer deep cleans for each customer on request. Deep cleans take twice as long as normal cleans. - I charge 50% more than a regular clean in that house. - For this I need to see the customers phone number, last name and the amount of money they will have to pay. - Please do it in this format: last name, first name (phone number) - price of service. -2) I would like to know how many months I have been working for each current customer. - If you could show the customers I have worked for for the longest time at the top, I would appreciate that. - Please include a column formatted like this: last name - weekly/bi weekly and a column for number of months -3) What is the average price I ask per hour for regular cleans and what is the average price per hour for deep cleans? -4) Which customer do I earn the most money from in a year? (not counting deep cleans) - And how much do I get from them? -5) How many customers did I gain in the year 2020 and how many did I lose? - -These are my customers: -first name, last name, phone number, address, frequency, start date, end date, price per hour, hours -Tara, Hughes, 727 456 2346, 3478 71st Ave N, bi weekly, $25, 5, 04-04-2017, null -David, Sullivan, 727 346 6945, 5061 47th St. N, bi weekly, $30, 6, 05-14-2019, null -Jennifer, Hill, 727 456 8689, 2890 6th St. S, weekly, $35, 7, 03-10-2020, null -Bob, Evans, 727 680 3867, 1747 1st Ave N, bi weekly, $30, 8, 08-15-2018, null -Amy, Campbell, 727 245 6956, 1820 Tropical Shores Dr SE, bi weekly, $35, 8, 05-24-2017, 11-29-2020 -Peter, Mitchell, 727 357 9765, 4059 Burlington Ave N, bi weekly, $30, 7, 09-30-2021, null -Sarah, Reed, 727 356 8708, 4908 Central Ave S, bi weekly, $32, 8, 12-06-2020, null -Diana, Moore, 727 476 7908, 5554 22nd Ave S, bi weekly, $25, 6,07-04-2017, 02-21-2021 -Amanda, Roberts, 727 446 7964, 2778 20th Ave S, weekly, $35, 8, 04-30-2020, null -George, Anderson, 727 589 5756, 1918 Sunrise Dr SE, bi weekly, $28, 5, 09-26-2017, null -George, Anderson, 727 589 5756, 2917 Beach Dr SE, bi weekly, $25, 3, 04-09-2018, null -Samuel, Newman, 727 374 6632, 3344 Oak St NE, weekly, $30, 6, 10-03-2018, 10-07-2022 -Judy, Davis, 727 233 0875, 2323 Mangrove St N, bi weekly, $25, 4, 12-28-2018, null -Walter, Nelson, 727 066 6356, 2734 Pinellas Point Dr S, bi weekly, $28, 5, 11-20-2019, null -Stephanie, Johnson, 727 007 5335, 1145 Driftwood Rd S, bi weekly, $32, 8, 08-03-2017, null -Heather, Miller, 727 568 9967, 2890 Coral Way N, bi weekly, $35, 8, 12-11-2019, 06-09-2020 -Michele, Lopez, 727 245 7667, 3786 Snell Isle Blvd NE, weekly, $35, 8, 09-26-2020, null -Michele, Lopez, 727 245 7667, 1604 Gulf Way, bi weekly,$35, 7, 01-25-2021, null -Rodney, Wright, 727 345 7857, 3675 Driftwood Rd S, bi weekly, $32, 6, 02-21-2021, null -Susan, Lee, 727 134 6783, 2674 Central Ave S, bi weekly, $27, 6,11-03-2021,null -Isaiah, Eisenberg, 727 794 6865, 1665 Bayshore Dr NE, bi weekly, $32, 5, 08-22-2018, null -Kelly, Brooks 727 456 7857, 1777 1st St S, bi weekly, $30, 5, 07-29-2018, null -Lisa, Adams, 727 285 8999, 1386 48th Ave N, bi weekly, $30, 6, 09-01-2020, null -Lisa, Adams, 727 285 8999, 1533 48th Ave N, bi weekly, $25, 3, 11-12-2017, null -John, Allen, 727 709 7985, 2722 Bay St NE, bi weekly, $30, 6, 03-31-2019, null -Kim, White, 727 264 8996, 1718 50th Ave N, weekly, $34, 7, 06-19-2019, 04-05-2020 -Christina, Lewis, 727 245 7240, 1444 Newton Ave S, bi weekly, $32, 5, 01-17-2021, null -James, Morris, 727 277 3365, 1006 5th Ave S, bi weekly, $35, 8, 09-08-2018, null -James, Morris, 727 277 3365, 4789 41st St S, bi weekly, $25, 4, 11-30-2019, null -Michael, Rogers, 727 955 62464, 2789 6th St S, weekly, $30, 8, 07-27-2017, null -*/ diff --git a/confectionery.sql b/confectionery.sql deleted file mode 100644 index 65cae71..0000000 --- a/confectionery.sql +++ /dev/null @@ -1,63 +0,0 @@ -/* -I recently started a home based baking business, together with my cousin. She works from her home in Lakewood, NJ and I work in Brooklyn, NY. -I sell cakes, cookies, and cupcakes for various events. I now want to keep a database of all orders. - -I need to know whether they order cookies, cake/s, or cupcakes. -I need to know the base of cookie/cake, what topping to decorate it with, and space to put in their custom order specifications. -I also want to know if they want a photo on the cake/cookie. -Please calculates the price of order when entered. -I need the name of the Customer, the branch they ordered from, date of order, amount they bought, how much the cost is per item and how much the whole order was. -I also want to keep track of the occasion they bought it for. - -These are the only options of cakes and cupcakes we make (so far): Chocolate, Vanilla, Coconut, Chocolate Peanut Butter, Banana, Strawberry shortcake -Toppings: Royal icing or fondant or frosting - chocolate, caramel, strawberry, coconut, peanut butter -All cakes are $50, strawberry shortcake is an extra $5. All cupcakes are $3, All cookies are $3.50, -A picture adds on $8 to the price of a cake and $1.50 to the price of a cookie. We don't offer pictures on cupcakes. - -I'll need these reports: -1) Sum of how many of each type of cake/cupcake/cookie is sold per branch. - Include the type of product and base but not the frosting or topping , and the sum of amount sold altogether. -2) How many orders per season, event, and branch (Ex: Summer, Engagement, Lakewood, 6) - Summer: July and August - Holiday time: September and October - Winter: November - April - Spring: May and June -3) How much money came in each month per branch -4) How many orders came in each month per branch - -Question: When is the earliest order? -Answer: I opened shop January 1, 2021. -Question: Do you have a minimum or maxmimum -Answer: Cookies have minimum order of 24 and maximum order of 500. - Cupcakes have a minimum of 12 and maximum of 500. -Question: Do you need to know the time it is entered? -Answer: No need to. - -Sample data: -Name, Branch, Date, Type of base, Item, Topping, Picture?, Specifics, Occasion, Amount, (Price per, Order price) -Chaim Green, Lakewood, 01/04/2022, Strawberry shortcake, Cake, (no topping), (no picture), Please make sure they both look the same, Baby, 2, ($55, $110) -Rivky Shapiro, Lakewood, 07/22/2021, Chocolate, Cake, Caramel, no, Write Happy birthday on cake, Birthday, 1 -Leah Gross, Brooklyn, 06/11/2021, Sugar, Cookie, Royal icing, yes, Graduation cap shape of picture I emailed, Graduation, 70 -Baruch Goldberg, Brooklyn, 09/12/2021, Sugar, Cookie, Royal icing, no, Shape of a mask and write thank you for keeping everyone safe and company logo, Company logo, 500 -Binyamin Stein, Lakewood, 02/15/2021, Vanilla, Cake, Chocolate, yes, Write Happy 85th birthday on bottom of the attached photo, Birthday, 3 -Batsheva Golden, Lakewood, 08/14/2021, Chocolate peanut butter, Cake, Peanut butter, yes, no, Write Shloimy and the number 3 on pic, Birthday, 1 -Rena Stern, Brooklyn, 10/11/2021, Sugar, Cookie, Fondant, no, Pink background with glitter and shape of balloon with word Sori, Bas mitzvah, 75 -Layala Katz, Lakewood, 09/05/2021, Vanilla, Cupcake, Strawberry, no, Make it look nice!, Birthday, 28 -Sara Leah Levy, Brooklyn, 05/18/2021, Vanilla, Cupcake, Coconut, no, none, Engagement, 100 -Devorah Friedman, Brooklyn, 07/04/2021, Strawberry shortcake, Cake, no topping, no, none, Wedding, 15 -Kaufman, Lakewood, 11/09/2021, Chocolate peanut butter, Cake, Chocolate, no, none, Bar mitzvah, 3 -Chana Cohen, Lakewood, 07/04/2021, Banana, Cake, Vanilla, yes, Attached photo, Anniversary, 1 -Ahuva Licht, Lakewood, 06/22/2021, Sugar, Cookie, Royal icing, no, Write Chaim and Devorah, Engagement, 75 -Tziporah Markowitz, Lakewood, 03/16/2021, Strawberry shortcake, Cake, no topping, no, no, none, Baby, 3 -David Fried, Lakewood, 10/01/2021, Chocolate peanut butter, Cake, Chocolate, no, no, none, Bar mitzvah, 2 -Moshe Abrams, Brooklyn, 08/23/2021, Vanilla, Cupcake, Peanut butter, no, Write 3 on it, Birthday, 150 -Rachel Bernstein, Lakewood, 02/28/2021, Sugar, Cookie, Fondant, yes, Attached photo of daughter, Bas mitzvah, 80 -Faiga Berg, Brooklyn, 10/12/2021, Chocolate, Cupcake, Chocolate, no, Add a pecan on each one, Event, 350 -Dena Bergman, Brooklyn, 06/08/2021, Sugar, Cookie, Royal icing, no, Write Shimon and Leah, Engagement, 75 -Asher Yechiel Eisen, Brooklyn, 12/31/2021, Sugar, Cookie, Royal icing, no, In shape of thirteen, Bar mitzvah, 175 -Mendy Fischer, Lakewood, 07/04/2021, Banana, Cupcake, Vanilla, no, For new baby, Baby, 100 -Chaya Kaplan, Lakewood, 01/01/2021, Chocolate, Cupcake, Vanilla, no, Make it taste great please, Birthday, 100 -Sarala Schwartz, Brooklyn, 06/09/2021, Chocolate, Cupcake, Vanilla, no, none, Baby, 50 -Sarah Braunstein, Brooklyn, 10/24/2021, Sugar, Cookie, Royal icing, yes, See attached picture of my house, Family party, 110 -*/ - diff --git a/costume.sql b/costume.sql deleted file mode 100644 index 3e4e340..0000000 --- a/costume.sql +++ /dev/null @@ -1,61 +0,0 @@ -/*Hi, I have a small home-run business selling costumes. Until now I've only been selling to family and friends, but I recently decided to open my business -to the public starting January 1, 2020. -I am now going to need a database to keep track all the costumes that are sold. -I want the name of the customer, which costumes they bought, which size, how much I paid per costume, how much they paid per costume, -how many they bought, did they pay full price, date I bought, date I sold. -I also want the total price that the customer paid. - -There are only 5 options of prices in my store. The prices go according to the size: - Size: Cost Price: Price Sold: - XS $15 $20 - S $17 $22 - M $20 $25 - L $22 $27 - XL $25 $30 - -So far I only sell the following costumes: - American Girl Doll - Artist - Bumble Bee - Colonial Boy - Colonial Girl - Elephant - Fire Man - Police Man - Princess - Zebra - -I am going to need the following reports: - 1. I need to know which costume is the most popular. - 2. I need to know which size is the most polpular. - 3. I need you to show me all of my customers in the following format: name: amountbought - costume customer bought (how much they paid) - 4. I need to know the profit each sale. - -Questions: -Q: Do you need the first name of the customer? -A: Yes, because sometimes I have 2 cusotmers with same last name. - -Q: Do you ever sell anything for less than cost price? Do you ever go on sale? -A: No, I never sell anything for less than cost price. I don't either go on sale, but sometimes (like for family) I will give a costume for exactly cost price. - -Q: Do you ever sell something in advance (before you have it in the store)? -A: no - - -Sample Data: -CustomerName, CostumesBought, Size, AmountBought, SoldPricePerCostume, DateBought, DateSold -Chana Goldberg, Artist, XS, 2, 20, Feb 14, 2020, Apr 2, 2020 -Aliza Duetch, Fire Man, L, 1, 22, Mar 9, 2021, Jan 4, 2022 -Dovid Rosen, Zebra, S, 1, 22, Aug 23, 2020, Aug 25, 2020 -Shira Pent, Colonial Boy, XS, 1, 20, Sep 17, 2021, Dec 4 2021 -Miriam Gruen, Princess, M, 3, 25, Jul 6, 2022, Oct 19, 2022 -Shoshana Victor, Elephant, XL, 1, 30, Nov 28, 2020, Feb 2, 2021 -Mendy First, Colonial Girl, XS, 1, 20, May 24, 2021, July 17, 2021 -Yisroel Horowitz, Police Man, XL, 1, 30, Jan 16, 2022, Jan 19, 2022 -Aliza Duetch, American Girl Doll, S, 2, 22, Mar 12, 2021, June 21, 2021 -Rochel Rubin, Bumble Bee, S, 1, 22, Sep 11, 2020, Jan 2, 2021 -Bracha Ganz, Princess, M, 4, 25, Nov 3, 2020, Dec 12, 2021 -Yaakov Cohen, Princess, XS, 1, 20, Dec 4, 2021, July 25, 2022 -Rina Rosen, Artist, M, 1, 25, Feb 18, 2022, May 28, 2022 -Rivkah Goldberger, zebra, S, 1, 22, Sep 14, 2022, Dec 29, 2022 -*/ \ No newline at end of file diff --git a/music rental.sql b/music rental.sql deleted file mode 100644 index 3358553..0000000 --- a/music rental.sql +++ /dev/null @@ -1,44 +0,0 @@ -/* -Hi, I run a music rental shop called The Music Note. -People rent instruments from me for short periods of time. -I need a system that will help keep track of all my instruments. -I need to know the name of the instrument, category, and cost of renting it per month. - -Each instrument I own has a unique ID that I need to know as well. The ID is the first 3 letters of the intrument name and first 3 letters of instrument category. -If the instrument has been returned already, I need to know the total profit I made (assuming there was no expenses involved). -I also need to know the date rented and the date returned. -In addition, I need to know the name of the customer. -One more thing I need is the date and time the rental was inserted into the system (for records purposes) - -Question: Is there a min and/or max amount of months to the rental? -Answer: Yes - min is one month and max is 12 months. After 12 months, the rental contract needs to be renewed again. -(But the customer can rent the same instrument again) - -Question: Can a customer rent an instrument in advance? -Answer: No - he has to come into the store and do it then. - -Question: Do you have more than one of each type of instrument? -Answer: Yes, I have many of the more popular instruments. - -Reports: -1) I need to know if I have any repeat customers and what they rented. -2) I need to know the most popular category of instrument that has ever been rented. -3) I need to know which instrument (that is not being currently rented) made the most profit. -4) I need to know which instruments were rented for only one month (so I could know if I should just sell them off). - -Sample Data: -CustomerName, Instrument, Category, MonthlyRentalFee, DateRented, DateReturned -Esther Shields, Flute, Wind, $30, Jan 01 2021, May 03, 2021 -Mendy Weiss, Violin, String, $40, June 07 2019, Feb 16, 2020 -Rochel Silber, French Horn, Brass, $70, March 29, 2021, April 28, 2021 -Sari Cohn, Clarinet, Wind, $35, July 12, 2020, November 14, 2020 -Yaakov Kleinman, Guitar, String, $42, September 12, 2020, April 24, 2021 -Shmuli David, Piano, Percussion, $65, March 23, 2019, August 15, 2019 -Baila Weitz, Trumpet, Wind, $53, May 03, 2020, December 29, 2020 -Hadassah Gruber, Guitar, String, $42, January 03, 2020, September 28, 2020 -Rivkala Scheiner, Violin, String, $40, May 24, 2021, January 01, 2022 -Chaya Faiga Rothstein, Clarinet, Wind, $35, November 18, 2020, September 16, 2020 -Tehilah Katz, Guitar, String, $42, February 13, 2021, April 12, 2021 - -Thank you! -*/ diff --git a/pet grooming.sql b/pet grooming.sql deleted file mode 100644 index ab6fe21..0000000 --- a/pet grooming.sql +++ /dev/null @@ -1,44 +0,0 @@ -/* -Hi, -I run a mobile pet grooming business that began in 2019. Our business has recently grown considerably as people allow us back into their homes. With this increase, we need -an organized method of keeping track of our customers (and their pets). We need to record the pet owner's name, adress, what kind of pet they have, the name of their pet, -price per grooming, frequency of service, and the date we picked them up. - -Questions: -Q)What are your options for frequency of service? -A)We only offer weekly and biweekly service. - -Q)Do you need to keep track of previous customers? -A)Yes, at present, we have had no customers drop us, but we should have a column available for when we need it. - -Q)Do you offer your services for all animals? -A)No, we only offer grooming for dogs, cats, rabbits, and guinea pigs. - -Q)Can one customer have multiple pets? -A)Yes, we record each pet seperately, and just repeat the owner's information for each pet. - -Reports: -1)We need a list of how many of each pet we currently have. -2)we need to see how many customers have multiple pets. -3)We need a list of the number of each kind of animal we have, for advertising and hiring purposes -4)We need to know the average amount we make per animal type - -Sample Data: -Bry-Ann Yates, 326 34th St. S, rabbit, Longears, $30, weekly, August 21 2019 -Meg Ross, 1719 Beach Dr SE, dog, Trooper, $55, biweekly, January 19 2020 -Brayanna Mille, 2255 22 Ave N, rabbit, Hunny Bunny $40, biweekly, November 5 2019 -Brayanna Mille, 2255 22 Ave N, rabbit, Hazel, $40, biweekly, November 5 2019 -Marianne Griffin, 312 Sand Pine Ln, dog, Mr. Stich, $60, biweekly, June 20 2021 -Mike Smith, 145 Menhaden St, guinea pig, Pippin, $30, biweekly, April 30 2022 -Bethany Singer, 1818 Bay St, cat, Dingus, $40, biweekly, June 7 2022 -Bobbi Welker, 324 Wilcox St, dog, Moose, $45, weekly, March 14 2021 -Bobbi Welker, 324 Wilcox St, dog, Piper, $60, weekly, March 14 2021 -Bobbi Welker, 324 Wilcox St, dog, Kipper, $65, weekly, March 14 2021 -Mark Doppler, 5329 53rd St, guinea pig, Ginger, $35, biweekly, October 29 2019 -Tara Hamid, 210 Sunrise Dr., rabbit, Holly, S50, biweekly, December 12 2021 -Leni Baker, 3210 Gandy Blvd., cat, Pussy Willow, $55, weekly, September 24 2019 -Leni Baker, 3210 Gandy Blvd., cat, Kitty Cat, $60, weekly, September 24 2019 -Heather Rieder, 937 MLK St., rabbit, Hopper, $45, weekly, February 2 2022 -Lee Kleshinski, 4903 49th Ave, dog, Phillip, $60, weekly, July 8 2021 -Tracy Price, 9027 Juniper St, rabbit, Dopey, $55, biweekly, September 30 2019 -Tracy Price, 9027 Juniper St, guinea pig, Spicy, $40, biweekly, September 30 2019 \ No newline at end of file diff --git a/real estate.sql b/real estate.sql deleted file mode 100644 index 92cd83f..0000000 --- a/real estate.sql +++ /dev/null @@ -1,53 +0,0 @@ -/* -I run a residential Real Estate business based in Lakewood, NJ since 2009. We don't actually own the houses, we are just the realtors. -Until now we only bought and sold in Lakewood. We didn't even enter the town into our sytem because it was a given. -Now, with the rapid growth of the community, there isn't much to buy and sell in Lakewood anymore. -We began to expand to buy and sell in Jackson, Toms River, Howell, Brick , and Manchester. We now need to record what town each house is located in. -When we tried to amend our program we noticed many weaknesses in our current system. We decided we are best off starting from scratch. - -We record the address of the house and the town the house is in. -We then record the type of house (bi-level, colonial, ranch, split-level, duplex, townhouse or vacant land), and the sqare-footage of the house. -We also want to record amount of Bathrooms and Bedrooms. -We don't do any renting, we do sometimes sell individual apartments. -We need to record who owns the house and which one of our realtors is working on this house. We also need to record who our client is. -Sometimes houses are owned by entities so we need to know who is the individual we are in contact with. We also want to record on what date -the house was put on the market and if it was sold. If it was sold, we need to know the following: who it was sold to, date sold, asking price and selling price. -If the house is not sold, record if it is in contract. - -Q: Do you enter the houses into your system before they are officially on the market? -A: No. - -Q: Are houses ever sold before they are put on market? -A: No, sometimes they are sold the same day - -Q: Do you have any other types of houses besides for what was listed above? -A: No, we do sell apartments once in a while. - -Q: Do you deal with houses out of the towns listed above? -A: Not as of yet, but with the rapid growth of the area, you never know. - -Q: What's the least and most you would sell a house for? -A: We don't sell houses for less than $100,000. Even when we sell apartments, we only sell if we could sell for $100,000. So far we never sold -for more than 1.5 Million. With today's inflation and rising Real Estate market, I want the system to allow up to 9.9 million - -Q: Do you ever sell for less than the asking price? -A: We don't - -Q: Do you want to record the Square footage of the house or the plot of land? -A: Both, put it in 2 seperate columns - -Reports: - -1) I want a report of all the houses sorted by the block and then by the town/city -2) I want a report of all the houses sorted by realtor -3) a report of how long it took for each house to sell -4) the price difference from the asking price to the sold price - -Sample data: -5 Lynn Drive, Toms River, Colonial, 4 Bdrms, 2.5 baths, house-3000, lot-42000 , Owner - Lynn Drive, LLC , Client- Yaakov Fishman, Realtor - Rivka Harnik, 1/12/2021, 2/22/2021, asking-450k, sold 475k, buyer-Rachel Gestetner -8 London Drive, Lakewood, Ranch, 3 bdrms, 2 baths, house-2000, lot - 4089, owner-Shaindy Braun, Client-Shaindy Braun, realtor, Raizy Berger, 4/5/2009, 7/10/2010, asking 200k, sold 200k, buyer-Elazar and Faigy Adler -423 2nd Street, Lakewood, Colonial, 9 bdrms, 5.5 baths, house 3500, lot-4200, owner- L3C Jackson, LLC, client-Mark Farkas, Rivka Harnik, 1/6/2015, 6/9/2015, asking 360k, sold 370k, buyer Yossi Handler and Rivky Handler -176 Hadassah Lane, Lakewood, duplex, 5 bdrms, 2.5 baths, house-2550, lot-3049.2 , Greenview Equities, LLC, shlomo press, Moshe Celnik, 5/3/2021, not sold, asking 549k, selling 600k, buyer Shea Speigel, under contract -1141 Central Avenue, Lakewood, ranch, 3 bdrms, 1 bath, house-855, lot-5000, Sorah Hager, Yitzchok Tendler, Moshe Celnik, 1/2/2022, not sold, asking 300k, not in contract - -*/ diff --git a/recruiting educators company.sql b/recruiting educators company.sql deleted file mode 100644 index 7417c70..0000000 --- a/recruiting educators company.sql +++ /dev/null @@ -1,42 +0,0 @@ -/* -I have a recruiting company called Educators Connect, which specializes in helping educators find jobs, mainly right after graduating. -Every day we place many educators in different schools all over New York. -In order to conduct data analysis, we want to keep track of our educators and various details about them. - -I need to know the first name, last name, date of birth, gender, college attended, and title of their degree. -Then I need to know how they found out about recruiting company, the date they contacted us, which school we placed them in and the date we found them a job. - -Reports: -1. I need to know how many students from each college we were able to find jobs for in under 2 weeks. - This will help my company know which college's graduates we should try to attract to our company. -2. Who were we more successful in placing, males or females? -3. On average, how many people contact us every day and how many people fnd out about us per form of media. - This will help us decide which forms of media communication we should invest in. -4. On average, how many people do we succeed in placing per day? -5. How many educators get placed a day per type of education degree? -6. I need a list of the educators who reach out to us in the format of first name, last name, age, - degree. - -Question: Do you deal with all age brackets? -Answer: yes -Question: What are the forms of media you use to advertise? -Answer: We post ads about our company in magazines, newspapers, and social media sites. Sometimes people hear about us by word of mouth. -Question: Do you specifically help graduates who graduated from a New York College? -Answer: Not specifically. We help people who graduated from any college in the United States, but are living in New York. -Question: How long has your company been around? -Answer: I opened up about 5 years ago, on February 17, 2017. -Question: Are there any educators whom as of now, you have not succeeded in placing? -Answer: Unfortunately yes. This is why I would like you to conduct reports to see the factors specific to educators we struggle to place. -Question: Is there a certain degree level you mainly cater to? -Answer: No. We help those with any level of education degree, whether it's a bachechelors, masters, or PhD - -Sample Data: -First name, last name, DOB, gender, college attended, title of degree, Media, date contacted, school placed, date found job -Mary, Lynn, 9/13/2000, female, Excelsior College, BA in Mathematics Education, magazine, 5/2/2022, Brooklyn High School, 5/9/2022 -Josh, Frank, 4/23/1998, male, Georgia State University, MA in Social Studies Education, social media site, 2/12/2022, Manhattan Elementary School, 5/9/2022 -Charles, Smith, 7/9/1994, male, Excelsior College, PhD in Education, social media site, 8/7/2021, New York City Day School, 8/12/2021 -Samantha, Brown, 9/24/1999, female, Columbia University, BA in English Education, newspaper, 5/23/2021, Brooklyn High School, 7/30/2021 -Howard, Lang, 8/4/1998, male, Georgia State University, MA in History Education, word of mouth, 1/31/2022, null, null -Sarah, Blanks, 10/20/1995, female, Columbia University, MA in Science Education, social media, 5/23/2020, New York City Day School, 8/17/2020 -Ella, Lewis, 8/22/2000, female, Excelsior College, BA in English Education, word of mouth, 4/1/2022, null, null -Julie, Goldman, 3/30/1997, University of Denver, MA in Social Studies Education, social media, 7/14/2020, Manhattan Elementary School, 8/17/2020 -*/ diff --git a/social services agency.sql b/social services agency.sql deleted file mode 100644 index 6101e29..0000000 --- a/social services agency.sql +++ /dev/null @@ -1,97 +0,0 @@ -/* -Note: Calculations are challenging therefore it requires an update after the insert as you cannot have a computed column based on a computed column. - -Good Evening, -This is Sandra from the social services agency in Central Jersey. -Our Department processes applications for the Supplemental Nutritional Assistance Program(Snap), also known as food stamps. -We are looking to implement an automated system to evaluate the eligibility of the applicants. - -We collect the following information from each application: - Family name, Phone number, Address, Family size, Earned income, Unearned income, Daycare expenses, Shelter expenses and Standardized utility expense. -We also refer to some other fixed information based on the family size, including: - Gross income limit, Standard deduction and a Maximum benefit amount. (this information is provided in the charts below). - -In order for a family to be determined eligible there are two qualifications. - -A: Their total income, earned + unearned, must be under the gross income limit for their family size. - -B: Snap benefits are based on a calculation of various ratios of income and expensed. In order for a family to qualify the calculation must result in a benefit amount greater than $0. -The calculation is based on a series of intricate steps and we would like to have each step stored in an easy and accessable manner so that our eligibility determination system can run smoothly. -The calculation which determines each family's benefit amount is as follows: - Step 1: we take 80% of the earned income plus all of the unearned income to determine the family's 'GROSS INCOME' - Step 2: we deduct the standard deduction based on the family size as well as any daycare expenses from the gross income to determine the family's 'NET INCOME BEFORE SHELTER' - Step 3: now we calculate the shelter expense plus the utility expense. - if it exceeds 50% of the 'net income before shelter' then we deduct the amount that it exceeds it by from the 'net income before shelter' to get the 'NET INCOME AFTER SHELTER' - for example if someones net income before shelter is $100 and their shelter plus utilities is $65, it exceeds 50% of the net income before shelter by $15, so we would deduct $15 from the net income before shelter (which is $100) and get $85 as the 'Net income after shelter' - Step 4: we now take 30% of the net income after shelter as '30% OF NET INCOME AFTER SHELTER' - Step 5: we take the maximum benefit amount for the family size (chart provided below) and subtract 30% of net income after shelter to determine the family's 'BENEFIT AMOUNT' -The benefit amount is the amount of $ the family will get each month on their snap card to spend on groceries - -We will need the following reports: - 1) We need a list of eligible families showing their Name, Address and Benefit amount. - 2) We need a list of all ineligible families showing their Name, Address and Benefit amount. - 3) We need a count of all applicants who were under the income limit for their familys size but found not eligible for benefits. - 4) We need a count of the number of applicants whose unearned income is greater than their earned income. - 5) During Covid eligible families are being given the maximum benefit for their family size every month regardless of their actual benefit amount as long as they are eligible for $1 or more. Can you give us a list of all eligible families, including their real benefit amount, the maximun benefit for their family size and the amount of extra benefits they recieve each month due to covid. - - -Question: Can a family apply with no income? no daycare expense? no shelter expense? no utility expense? -Answer: Though most families have at least a bit of income, we do occaisionlly have families that are not earning any income at the time of application. - There are many families that do not have a daycare expense. - Occaisionally we have families who do not have a shelter expense, either because they are living rent free or because someone else is paying it for them. - Yes some families do not pay for their utilities on their own. - -Question: Can the net income before or after shelter be a negative number? -Answer: No. If their expenses exceed their income enough that it would result in a negative number we count it as 0. - -Question: Which places do you accept applications from? -Answer: Our office is actually designated specifically towards residents of lakewood NJ, it is therefore not necessary to store the applicant's town, state and zip code - -Question: What is the highest monthly income amount a family would apply with? -Answer: Any application that has an income of greater than $25,000 monthly would be automatically rejected. - -Question: What is the largest family size there is? -Answer: Although the Lakewood families tend to be large we don't expect to have a family with more than 17 eligible members. - - - -Sample Data: (Listed in the following order: Family name, Phone Number, Address, Family Size, Earned Income, Unearned Income, Daycare expenses, Shelter expenses, Standerdized utility expense) -Smith, 732-901-1234, 1 Happy Lane, 4, $2500, $500, $180, $900, $548 -Adams, 732-942-0987, 2 Joyous Drive, 8, $5400, $1200, $360, $1750, $548 -Jackson, 848-226-8765, 3 Momentous Place, 2, $1500, $1000, $0, $1000, $29 -Tyler, 732-886-6543, 4 Drake Road, 3, $3000, $1200, $400, $1800, $548 -Buchanan, 732-994-2345, 5 Hickory Drive, 15, $10,000, $0, $810, $2250, $548 -Arthur, 848-210-9843, 6 Misory Lane, 1, $9870, $0, $0, $670, $29 -Wilson, 732-290-8764, 7 Smoke Lane, 3, $1500, $301, $230, $1000, $369 -Hoover, 732-543-2109, 8 Justice Place, 7, $3434, $3434, $343, $1343, $548 -Truman, 732-994-2210, 9 Yorktown Blvd, 5, $4500, $1200, $400, $1800, $548 -Johnsohn, 732-998-7654, 10 Branchtown Road, 10, $10000, $500, $510, $1200, $548 -Nixon, 732-886-4325, 11 Letsgo Place, 5, $400, $600, $300, $1150, $369 -Carter, 732-990-9990, 12 Bored Town Road, 2, $2000, $500, $0, $1150, $369 -Biden, 848-998-9876, 13 Icantthink Lane, 13, $9950, $100, $0, $1800, $548 -Cohen, 732-765-4321 14 Winya Place, 9, $6000, $1300, $400, $275, $369 - -Thank you for collaborating in our efforts to find and create Solutions To End Poverty Soon. - - - -Additional Information Bases on Family Size: -Family Size: Monthly Income Limit: Maximum Benefit Amount: Standard Deduction Amount -1 $1986 $250 $177 -2 $2686 $459 $177 -3 $3386 $658 $177 -4 $4086 $835 $184 -5 $4786 $992 $215 -6 $5486 $119 $246 -7 $6186 $131 $246 -8 $6886 $150 $246 -9 $7586 $169 $246 -10 $8286 $188 $246 -11 $8986 $206 $246 -12 $9686 $225 $246 -13 $10386 $244 $246 -14 $11086 $263 $246 -15 $11786 $282 $246 -16 $12486 $281 $246 -17 $13186 $299 $246 -*/