Entity Framework Group Results By Day - entity-framework

I have this EF Object/Table called Person with this fields
ID
FullName
Status
DateRegistered
I need to select all persons registered per day with status = 1. The result should be an object with 2 properties
DateRegistered (A Single Day)
List of Persons

Related

Entity Framework Column with values from 2 tables

For simplicity, I have a database with this tables
Toys
- Id
- Name
Fruits
- Id
- name
Orders
- Id
- Product (contains Fruits.Id or Toys.Id)
- Type (1 if Fruit, 2 if Toy,....)
- Qty
¿how can I map "Product" to store id´s from 2 entities (Fruits or Toys)?
PD: The Id of toys and fruits never match
Thanks
If this is a hard requirement then I would do it by making a view in the database called Products, and it would be a union between Toys and Fruits.
But notice that the navigational property Product, on orders then will be of type Product, and you have to map it to Fruit or Toy manually.

Core data group by and count the number of row

I am new to the core data and swift, I need to get the unique name and count of particular category which has occur in Product rows.
Here is the core data entity structure.
Product: category:String, name:String, store:String
using core data I want to execute the following sql like query
select category, count(*) as total from Product group by category order by category desc.
Please help me to get it done in swift3 with complete reference.

Adding two non-relation Entities to DbContext that second entity use the first one's Id entity

in code first, When I want to save 2 related entities (for example Country entity and City entity), first, I create an instance of Country and second create an instance of City and put object of Country to navigation of City, at last SaveChanges.in this process Database, first, create the Country and then put its Id to CountryId field of City entity and save city to database. so now, I want to do the same but with non-related entities. this means I want to send 2 entity (without relationship) to DB, that fist, first one saved and second one get its Id, and use it, at last Save...

How to create an Apex Trigger which calculates the number of students present in a group?

I want to create an apex trigger on the Student object and calculate the number of students present in that group .
if the group name or Id or any identifier is on the student object as a field you can query your SFDC Database to retrieve the students related to that group. It would be something like this:
List<Students__c> students = [SELECT Id FROM Student__c
WHERE group__c = 'The group name or ID'];
Then you can use the students.size() method to get the number of students in that group.

How to do sorting base on field of document?

Let's say i have a lot of data with this pattern in mongoDB:
db.customer.find()
{'_id':ObjectId('someId'),'customer':'brendon','address':'singapore','activity':[{'id':someId,'detail':'approaching'},{'id':someId,'detail':'explaining'},{'id':someId,'detail':'deal'}]}
this data means i have customer collection and each customer has array of activity,
now, for all customer i want to do paging/sorting the activity about 10 activity per page base on customer/document.
and
how to do this in mongoDB.
in relational sql this is represented with:
customer (custId, name, address)
activity (actId, detail, custId)
select * from activity
left join customer
limit 10,0