Limit the number of record in a relation - ms-access

I've a relation 1:M ina MS Access database. Is there a way to lock the maximum number of records in the "M" side of relation? So for any entry in the first A table I could have only a certain number in the M table?

Related

How to specify multiple ids for one record

I have records table with booking records info (8 columns). And I want to add to a record information about extra services that a client booked. I created extra_services table, but how can I specify multiple extra services to one record in records table?
If I add 9th column with just one id of extra service then there will be redundancy problem.
It depends a little on what is the content of the extra_services table. If it does contain a set of extra services that can be booked you need a table to cross reference the bookings with the extra_services.
If on the other hand you are storing the booked extra services belonging to the record you can just use a ForeignKey field to the index of the records table in the extra_services table, that way you can track which records in extra_services belong the booking record.

Can I make a query relating 2 tables Without primary key and foreign key?

I am importing data from excel file to MySQL ,using php MyAdmin as tool manager through PHP. It's a printer report where every user have an unique user_id but can make many registers per day what I want is relate one table which contains the user's id and the registers per day and in another table I have information about cost center of each user, what I want to query is the top of users that make more registers per month but not printing the users itself (the info contained on the first table) but the cost center of that users contained on the second table, etc, if on the first table there is an unique ID per activity it is possible relate to the second table which also contains the users ( user_id ) and center cost?

Delete from linked tables ms access

I have a MS Access DB that has several tables.
My main table is called Client, which is linked to another table called Abonament, among others.
Both tables share the same field named client_id, which contain identical id's.
Table named Abonament has another field named data_expirarii which contains dates.
How do I delete all the entries from both tables (Client & Abonament) based on a specific date in data_expirarii field, from the Abonament table?
I've managed to delete them from the Abonament table using the Design Wizard and subsequently deleting every entry below or equal to 1-Jun-17 (<= 1-Jun-17) but the client entries remain in the Client table. MS Access gives me a headaque.
First you need to delete the records from the Abonament table.
DELETE *
FROM Abonament
WHERE data_expirarii<=#06/01/2017 23:59:59#
Note: the US format of the date (mm/dd/yyyy)- this format must be used.
Next any client records that no longer have any matching records in Abonament can be deleted. This query will return all records from Clients (written on the LEFT of the join) and only those records in Abonament that have a matching Client_ID - any other record will return NULL in the Abonament.Client_ID field which are filtered for in the WHERE clause and deleted.
DELETE DISTINCTROW Clients.*
FROM Clients LEFT JOIN Abonament ON Clients.Client_ID = Abonament.Client_ID
WHERE Abonament.Client_ID IS NULL
Make sure to take a back-up of your data while testing!

How Can I Best Perform This Kinda Of Table Relationship?

i'm developing Fantasy App.
I create one table called 'Tournaments' and one table called 'Entries'.
I want have the total number of entries for each tournament.
I really don't want query everytime the table 'Entries' to count the number of entries for each 'Tournament'. So i think in put also some column on 'Tournaments' table calling column 'entries_total'.
How is the best way to perform this ?
To resume the goal: Have the total number of tournaments entries in an column on the 'Tournaments' table.

Is a bidirectional self-join relationship in Filemaker possible?

I have a table of transactions. For any given record, I want to be able to include a portal which shows all related transactions. Since the related records are in the same table as the parent record, I have created a second table occurrence (TO). I have linked these two TOs with a join table, into which I enter the foreign keys of the two TOs to indicate which records relate to which other records.
On the layout for a given transaction, I've added a portal which displays related records from the second table occurrence. So far, so good.
So, let's say in the join table I said transaction 100 is linked to transactions 105 and 110. In the portal for transaction 100, I can see records 105 & 110.
However, I would also like to see transaction 100 in the portal for transaction 105, but can't figure out how to do this, without having to manually enter the same relationship, but in reverse.
NB. I'm using Filemaker Pro 12.
You need to create two records for each relationship in the intermediate table to do this.
For example, you have TO_1 and TO_2 and an intermediate table. The intermediate table has two fields, id_1 and id_2. When you create a relationship between TO_1 and TO_2, create two records in the intermediate table. One record stores the id of TO_1 in id_1 and TO_2 in id_2. The second record stores the id of TO_1 in id_2 and TO_2 in id_1.
It sounds like you want all the foreign keys to be present in a single field that you use a multi-key. In your example, the multi-key would look like this:
100
105
110
If you do not want to display the present record in a portal of related records, you can omit it be defining the relationship to exclude itself by adding the predicate something like this:
fk = fk AND
pk ≠ pk
Would that work?