I am new to access, and I am trying to make a simplae project of managing users.
I have a table of USERS, and to more tables of SERVICES and GAMES.
I have connections of ID in USERS, and ID -> USER_ID in SERVICES, as well in GAMES.
Now I want to display in one form, USER profile, and to print the games related to the user and the services related to the user.
I added a query, that joins with USERS and SERVICES and GAMES, and it shows everything right, except that if the user for example has two services and only one game connected to the USER_ID, then it prints the game twice.
is there a way to display it correctly?
in normal SQL and PHP, it would be easy, though in access I have no idea how to do it.
thaks
Related
I'm developing a web application that contains a messaging system. The web application has a basic entity (users), users can own another entity in the application (companies), each company may have more than one user (think of it as employees of a team). A user might not necessarily have a relation with a company. A company must have a relation with at least one user.
I'm trying to create a messaging (more of an intra-application email system rather than a chat) system within the application. However, the messaging system has certain restrictions on who is allowed to send messages to whom:
Users can send messages to companies
Companies can send messages to users
Companies can send messages to companies
We will have two different inboxes/outboxes for users and companies. Meaning inside the dashboard, if a user owns a company, he will have a page to his own user inbox, and a page for his company inbox.
My problem is with determining the entity of the sender and receiver and I can't seem to find a good maintainable table design for the messages table.
Below is the structure for the users table, companies table and company_users table:
The design I had in mind (which after implementation I don't believe is the best possible design) is to have a sender_user_id field and a sender_company_id field for each row. If the sender_user_id is null, while sender_company_id is set. This would mean that the sender of this message is a company and vice versa. The same thing for the receiver. Below is the design for the messages table
Does anyone have a better design in mind? Something more maintainable maybe? This is currently relationship hell in the backend. Thank you.
Taking into account Microsoft ExchangeServer and its single instance storage as an example, I think the thing you're missing is pointers.
If your use cases were wound back to a single sender can send a single message to a single receipient then I think your schema would be almost bang on.
If you want a person (e.g. Company Admin) to be able to send a message to all members of a company then what you're actually saying is:
"I'd like the Company Admin to send pointers to the message to all current members of the company".
What I mean is that when they send the message, they're actually creating message_pointers to the original message. That way, when a recipient deletes "the message", all they're actually doing is deleting their individual reference to that message.
Does that help?
I am trying to build an API first web app that has two parts:
Part A: The Project Management App. This would be built using php/mysql. One of the table in the mysql DB will be the users table where all users information will be stored viz username, password, email etc.
Part B: The online chat App. The users of the project management system will be able to chat among themselves. This will be built using nodejs/mongo. The mongodb DB would store the chat transcripts of each users and so would have a users collection containing the user details. The users collection would contain the same user information that the mysql users table has viz username, password, email etc.
Now, i have a couple of questions in terms of the architecture of this app.
Question 1: Is it at all a wise idea to maintain two different sources to store the user's information? The reason why I wanted to have a replica of the users table in the MongoDB as well is because since there will be too many reads and writes happening in the chat app so its best we use a nosql DB. (Lets assume here that my app will be used heavily going forward)
Question 2: If the answer to Question 1 is "Yes", how do we make sure of data consistency? I have thought of two approaches to achieve this:
Option A: Since we are using the API first approach, so during the registration of a user when the CREATE user api call is made, it will add the user in both mysql and mongodb databases.
Option B: I setup a cron that will sync the data between the mysql users table and the mongodb users collection periodically.
Can someone please throw some light on this and tell me if my approaches are right and that if I am going towards the right direction.
Many thanks
I would like to use a Tab control to display the many side of a one-to-many relationship. However, I don't know at design time the number of records on the many side and was thinking of adding the number of Pages to the Tab control at runtime. But then I remembered that trying to change the design of a form needed exclusive access to the db. Has anyone successfully done this or might there be an alternative?
The one-side of the relationship has the customer details and the many-side are the details of the bank accounts for various currencies for that customer. A customer may only have one account for all currencies or a different bank and account for each currency. I was thinking the Caption of each Page of the Tab control would show the currency if there were many accounts for the customer.
I am creating a web application but I am not very comfortable with database designs.
So user can only be an enterprise or an organisation, so I added a picture here with my idea. But is there a better way to deal with that kind of user types? Or there should be just two seperate tables (enterprise, organisation) with login credentials and etc.
Personally I would class an Org and a Enterprise as the same thing (Database wise) as you can see by looking at your columns. They are all the same except for register number but I'm sure Organisations also have a unique ID number.
If I was doing this I would have:
User m->1 Business m->1 BusinessType
Also should a User not belong to a Company/enterprise/organisation? The way you have it only one user can ever be associated with each. If you had the FK on the User side you could associate many users with one organisation.
I have several different web applications with their own separate databases. All of these different web applications also use a common database for authentication which contains the list of all of my users and the user's name. To keep things simple, let just say my application databases are like a forum and they track user posts; in the tables they will store a userID and some post text.
Now the problem I am having is that some of my team members feel that what we are doing is messy and frictional because it kind of a pain how to get my applications to display a users name next to their posts which is a very common task. First I have to go to the application database and do something like SELECT userID, postText FROM tblPosts then I have to take that userID and go to the user database and get the actual name with SELECT name FROM tblUsers WHERE userID = X. And then merge data from those two queries together to get it out on the page.
I personally don't mind the way we are doing it as I think it's important to just use a single separate user database for data constancy, but some of my team members want to copy over all of the user names into the local application databases and store the user name next to the userID when recording posts so its super simple to get that information back out. In the event a user wants to change their name (a very infrequent event and we only have about 100 users) we should just run an update in the common database as well as all of the application databases.
This seems like a common issue people might have. Can someone please weigh in on the common approaches to dealing with the problem and what we might want to do.
You have a system with a working single-signon scheme (centralized user identity and authentication). That's a huge competitive advantage.
You've built it simply and cleanly. That's even more huge. This kind of thing is very hard to get right, and you have done that.
(If you were to try to build this with some system like LDAP or Active Directory, you'd have a lot of complex code to maintain.)
Don't let your fellow developers sacrifice that advantage for their personal convenience. If you have to synchronize changes to the user database, you will have problems when things get out of sync. It's a when question, not an if question.
By the way, if your user database and website specific databases are on the same MySQL server, you can do stuff like this to integrate the use of the two different databases. That may meet the needs of your developers.
SELECT u.username, d.opname
FROM userdatabase.users u
JOIN website.transaction d ON u.userid = d.userid
But if you do this, you'll make it hard to migrate your various website databases to other server machines in the future.