{"id":21813569,"url":"https://github.com/vahidn/queryinginefcore","last_synced_at":"2025-06-13T04:32:30.480Z","repository":{"id":66345074,"uuid":"282623095","full_name":"VahidN/QueryingInEFCore","owner":"VahidN","description":"Querying in Entity Framework Core","archived":false,"fork":false,"pushed_at":"2023-05-15T11:37:20.000Z","size":184,"stargazers_count":26,"open_issues_count":0,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T23:36:49.232Z","etag":null,"topics":["ef-core"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VahidN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://coffeebede.ir/%D9%88%D8%AD%D9%8A%D8%AF%D9%86%D8%B5%D9%8A%D8%B1%D9%8A","https://www.buymeacoffee.com/vahidn"]}},"created_at":"2020-07-26T10:06:46.000Z","updated_at":"2024-09-16T05:27:17.000Z","dependencies_parsed_at":"2024-11-27T15:01:22.433Z","dependency_job_id":null,"html_url":"https://github.com/VahidN/QueryingInEFCore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/VahidN/QueryingInEFCore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VahidN%2FQueryingInEFCore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VahidN%2FQueryingInEFCore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VahidN%2FQueryingInEFCore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VahidN%2FQueryingInEFCore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VahidN","download_url":"https://codeload.github.com/VahidN/QueryingInEFCore/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VahidN%2FQueryingInEFCore/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259580857,"owners_count":22879740,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ef-core"],"created_at":"2024-11-27T14:30:02.680Z","updated_at":"2025-06-13T04:32:30.459Z","avatar_url":"https://github.com/VahidN.png","language":"C#","funding_links":["https://coffeebede.ir/%D9%88%D8%AD%D9%8A%D8%AF%D9%86%D8%B5%D9%8A%D8%B1%D9%8A","https://www.buymeacoffee.com/vahidn"],"categories":[],"sub_categories":[],"readme":"﻿# Querying in Entity Framework Core\n\nIf you are new to EF-Core and you don't know how to convert your existing SQL queries to LINQ to entities queries, these exercises will help you to get started.\n\nThese samples are ported from [PostgreSQL Exercises](https://pgexercises.com/) to EF-Core.\n\n![Querying in Entity Framework Core](/App_Data/EFCorePgExercises.png)\n\n## [Simple SQL Queries](/Exercises/SimpleSQLQueries)\n\n- [Retrieve everything from a table](/Exercises/SimpleSQLQueries/RetrieveEverythingFromATable.cs)\n- [Retrieve specific columns from a table](/Exercises/SimpleSQLQueries/RetrieveSpecificColumnsFromATable.cs)\n- [Control which rows are retrieved](/Exercises/SimpleSQLQueries/ControlWhichRowsAreRetrieved.cs)\n- [Control which rows are retrieved - part 2](/Exercises/SimpleSQLQueries/ControlWhichRowsAreRetrievedPart2.cs)\n- [Basic string searches](/Exercises/SimpleSQLQueries/BasicStringSearches.cs)\n- [Matching against multiple possible values](/Exercises/SimpleSQLQueries/MatchingAgainstMultiplePossibleValues.cs)\n- [Classify results into buckets](/Exercises/SimpleSQLQueries/ClassifyResultsIntoBuckets.cs)\n- [Working with dates](/Exercises/SimpleSQLQueries/WorkingWithDates.cs)\n- [Removing duplicates, and ordering results](/Exercises/SimpleSQLQueries/RemovingDuplicatesAndOrderingResults.cs)\n- [Combining results from multiple queries](/Exercises/SimpleSQLQueries/CombiningResultsFromMultipleQueries.cs)\n- [Simple aggregation](/Exercises/SimpleSQLQueries/SimpleAggregation.cs)\n- [More aggregation](/Exercises/SimpleSQLQueries/MoreAggregation.cs)\n- [Produce a list of facilities that are booked only in 2012](/Exercises/SimpleSQLQueries/ListOfFacilitiesThatAreBookedOnlyIn2012.cs)\n\n## [Joins and Sub-queries](/Exercises/JoinsAndSubqueries)\n\n- [Retrieve the start times of members' bookings](/Exercises/JoinsAndSubqueries/RetrieveTheStartTimesOfMembersBookings.cs)\n- [Work out the start times of bookings for tennis courts](/Exercises/JoinsAndSubqueries/WorkoutTheStartTimesOfBookingsForTennisCourts.cs)\n- [Produce a list of all members who have recommended another member](/Exercises/JoinsAndSubqueries/ProduceListOfAllMembersWhoHaveRecommendedAnotherMember.cs)\n- [Produce a list of all members, along with their recommender](/Exercises/JoinsAndSubqueries/ProduceListOfAllMembersAlongWithTheirRecommender)\n- [Produce a list of all members who have used a tennis court](/Exercises/JoinsAndSubqueries/ProduceListOfAllMembersWhoHaveUsedTennisCourt.cs)\n- [Produce a list of costly bookings](/Exercises/JoinsAndSubqueries/ProduceListOfCostlyBookings.cs)\n- [Produce a list of all members, along with their recommender, using no joins.](/Exercises/JoinsAndSubqueries/ProduceListOfAllMembersAlongWithTheirRecommenderUsingNoJoins.cs)\n- [Produce a list of costly bookings, using a sub-query](/Exercises/JoinsAndSubqueries/ProduceListOfCostlyBookingsUsingSubquery.cs)\n- [Produce a list of facilities which are not booked in 2013](/Exercises/JoinsAndSubqueries/ListOfFacilitiesWhichAreNotBookedIn2013.cs)\n\n## [Modifying data](/Exercises/ModifyingData)\n\n- [Insert some data into a table](/Exercises/ModifyingData/InsertSomeDataIntoATable.cs)\n- [Insert multiple rows of data into a table](/Exercises/ModifyingData/InsertMultipleRowsOfDataIntoATable.cs)\n- [Insert calculated data into a table](/Exercises/ModifyingData/InsertCalculatedDataIntoATable.cs)\n- [Update some existing data](/Exercises/ModifyingData/UpdateSomeExistingData.cs)\n- [Update multiple rows and columns at the same time](/Exercises/ModifyingData/UpdateMultipleRowsAndColumnsAtTheSameTime.cs)\n- [Update a row based on the contents of another row](/Exercises/ModifyingData/UpdateARowBasedOnTheContentsOfAnotherRow.cs)\n- [Delete all bookings](/Exercises/ModifyingData/DeleteAllBookings.cs)\n- [Delete a member from the cd.members table](/Exercises/ModifyingData/DeleteAMemberFromTheMembersTable.cs)\n- [Delete based on a sub-query](/Exercises/ModifyingData/DeleteBasedOnASubquery.cs)\n\n## [Aggregation](/Exercises/Aggregation)\n\n- [Count the number of facilities](/Exercises/Aggregation/CountTheNumberOfFacilities.cs)\n- [Count the number of expensive facilities](/Exercises/Aggregation/CountTheNumberOfExpensiveFacilities.cs)\n- [Count the number of recommendations each member makes.](/Exercises/Aggregation/CountTheNumberOfRecommendationsEachMemberMakes.cs)\n- [List the total slots booked per facility](/Exercises/Aggregation/ListTheTotalSlotsBookedPerFacility.cs)\n- [List the total slots booked per facility in a given month](/Exercises/Aggregation/ListTheTotalSlotsBookedPerFacilityInGivenMonth.cs)\n- [List the total slots booked per facility per month](/Exercises/Aggregation/ListTheTotalSlotsBookedPerFacilityPerMonth.cs)\n- [Find the count of members who have made at least one booking](/Exercises/Aggregation/FindTheCountOfMembersWhoHaveMadeAtLeastOneBooking.cs)\n- [List facilities with more than 1000 slots booked](/Exercises/Aggregation/ListFacilitiesWithMoreThan1000SlotsBooked.cs)\n- [Find the total revenue of each facility](/Exercises/Aggregation/FindTheTotalRevenueOfEachFacility.cs)\n- [Find facilities with a total revenue less than 1000](/Exercises/Aggregation/FindFacilitiesWithTotalRevenueLessThan1000.cs)\n- [Output the facility id that has the highest number of slots booked](/Exercises/Aggregation/OutputTheFacilityIdThatHasTheHighestNumberOfSlotsBooked.cs)\n- [List the total slots booked per facility per month, part 2](/Exercises/Aggregation/ListTheTotalSlotsBookedPerFacilityPerMonthPart2.cs)\n- [List the total hours booked per named facility](/Exercises/Aggregation/ListTheTotalHoursBookedPerNamedFacility.cs)\n- [List each member's first booking after September 1st 2012](/Exercises/Aggregation/ListEachMembersFirstBookingAfterSeptember1st2012.cs)\n- [Produce a list of member names, with each row containing the total member count](/Exercises/Aggregation/ProduceListOfMemberNamesWithEachRowContainingTheTotalMemberCount.cs)\n- [Produce a numbered list of members](/Exercises/Aggregation/ProduceNumberedListOfMembers.cs)\n- [Output the facility id that has the highest number of slots booked, again](/Exercises/Aggregation/OutputTheFacilityIdThatHasTheHighestNumberOfSlotsBookedAgain.cs)\n- [Rank members by (rounded) hours used](/Exercises/Aggregation/RankMembersByHoursUsed.cs)\n- [Find the top three revenue generating facilities](/Exercises/Aggregation/FindTheTopThreeRevenueGeneratingFacilities.cs)\n- [Classify facilities by value](/Exercises/Aggregation/ClassifyFacilitiesByValue.cs)\n- [Calculate the payback time for each facility](/Exercises/Aggregation/CalculateThePaybackTimeForEachFacility.cs)\n- [Calculate a rolling average of total revenue](/Exercises/Aggregation/CalculateRollingAverageOfTotalRevenue.cs)\n- [Produce running total count of bookings for each year](/Exercises/Aggregation/RunningTotalCountOfBookingsForEachYear.cs)\n- [Bookings count per year and sales growth as compared with the previous year](/Exercises/Aggregation/BookingsCountPerYearAndSalesGrowthAsComparedWithPreviousYear.cs)\n\n## [Working with Timestamps](/Exercises/WorkingWithTimestamps)\n\n- [Produce a timestamp for 1 a.m. on the 31st of August 2012](/Exercises/WorkingWithTimestamps/ProduceTimestampFor1AMOnThe31stOfAugust2012.cs)\n- [Subtract timestamps from each other](/Exercises/WorkingWithTimestamps/SubtractTimestampsFromEachOther.cs)\n- [Generate a list of all the dates in October 2012](/Exercises/WorkingWithTimestamps/GenerateListOfAllTheDatesInOctober2012.cs)\n- [Get the day of the month from a timestamp](/Exercises/WorkingWithTimestamps/GetTheDayOfTheMonthFromTimestamp.cs)\n- [Work out the number of seconds between timestamps](/Exercises/WorkingWithTimestamps/WorkoutTheNumberOfSecondsBetweenTimestamps.cs)\n- [Work out the number of days in each month of 2012](/Exercises/WorkingWithTimestamps/WorkoutTheNumberOfDaysInEachMonthOf2012.cs)\n- [Work out the number of days remaining in the month](/Exercises/WorkingWithTimestamps/WorkoutTheNumberOfDaysRemainingInTheMonth.cs)\n- [Work out the end time of bookings](/Exercises/WorkingWithTimestamps/WorkoutTheEndTimeOfBookings.cs)\n- [Return a count of bookings for each month](/Exercises/WorkingWithTimestamps/ReturnCountOfBookingsForEachMonth.cs)\n- [Work out the utilization percentage for each facility by month](/Exercises/WorkingWithTimestamps/WorkoutTheUtilisationPercentageForEachFacilityByMonth.cs)\n- [Find registered members in given months](/Exercises/WorkingWithTimestamps/FindRegisteredMembersInGivenMonths.cs)\n- [Produce quarterly count of booked items in 2012 and 2013](/Exercises/WorkingWithTimestamps/QuarterlyCountOfBookedItemsIn2012And2013.cs)\n\n## [String Operations](/Exercises/StringOperations)\n\n- [Format the names of members](/Exercises/StringOperations/FormatNamesOfMembers.cs)\n- [Find facilities by a name prefix](/Exercises/StringOperations/FindFacilitiesByNamePrefix.cs)\n- [Perform a case-insensitive search](/Exercises/StringOperations/PerformCaseInsensitiveSearch.cs)\n- [Find telephone numbers with parentheses](/Exercises/StringOperations/FindTelephoneNumbersWithParentheses.cs)\n- [Pad zip codes with leading zeroes](/Exercises/StringOperations/PadZipCodesWithLeadingZeroes.cs)\n- [Count the number of members whose surname starts with each letter of the alphabet](/Exercises/StringOperations/CountNumberOfMembersWhoseSurnameStartsWithEachLetterOfTheAlphabet.cs)\n- [Clean up telephone numbers](/Exercises/StringOperations/CleanupTelephoneNumbers.cs)\n\n## [Recursive Queries](/Exercises/RecursiveQueries)\n\n- [Find the upward recommendation chain for member ID 27](/Exercises/RecursiveQueries/FindTheUpwardRecommendationChainForMemberID27.cs)\n- [Find the downward recommendation chain for member ID 1](/Exercises/RecursiveQueries/FindTheDownwardRecommendationChainForMemberID1.cs)\n- [Produce a CTE that can return the upward recommendation chain for any member](/Exercises/RecursiveQueries/ProduceCTEThatCanReturnTheUpwardRecommendationChainForAnyMember.cs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvahidn%2Fqueryinginefcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvahidn%2Fqueryinginefcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvahidn%2Fqueryinginefcore/lists"}