473,387 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Extracting information from two different tables ..

I am creating a login page ,

tables:
database has tables "student" and "faculty"

schema:
"student" table has columns "sid,spass,sfname.....etc."
"faculty" table has columns "fid,fpass,ffname......etc."

Problem---
I want to create a temporary table which contains all
"sid,fid" as "username" column
and all "spass,fpass" as "password" column. thus resultant table should have only 2 columns containing username and password of all members , witch i can use further to apply validation for successful login.
So what query i have to write to extract that table ??
ps: tried join operations but cant figure it out :(
Dec 29 '15 #1
3 2172
zmbd
5,501 Expert Mod 4TB
AFIAK: You will have to use a UNION on either two queries or two views to achieve this; however, your schema doesn't seem to be the best.

tbl_Member_addressbook
(standard address book information less member names)

tbl_Member_account
(has the member's names and an account/badge name and a random number(salt))

tbl_member_address_profile
relates tbl_member_account to tbl_member_addressbook as more than one member could be residing at a given address.

tbl_Member_classifications
(has the classifications available, Faculty, Staff, Student, etc..)

tbl_Member_classification_profile
relates tbl_member_account to tbl_member_classifications
a member could be a student, staff, and or faculty

tbl_member_credentials
Could store a hash of the member's account/badge derived by using the account/badge, classification, salt from tbl_member_account_profile. There would be a second salt value here and this would be used with the entered pass phrase to create/verify the stored hash for the pass phrase.

In the long run you would have only the one table to validate any user credentials against once you've pulled the other information from the related tables.

I'm sure that there are much better schema then one I just outlined as it is quite literally a "top of my head" outline.
Dec 29 '15 #2
adriancs
122 100+
That's right. You should have only one table contains the login credentials.
Jan 1 '16 #3
I would use one table for login credentials with a field like uid, then use LEFT JOIN to set uid with fid or sid as the JOIN field. EX: "fid on uid" and "sid on uid". Joins can be confusing but it's essential to learn them.
May 4 '16 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: manning_news | last post by:
Using SQL2000. How do I format my select statement to choose one out of 24 different tables? Each table is slightly different and I was hoping I could use one select statement and format it...
7
by: Paolo | last post by:
I know I should not be doing this, but I find it very useful. I have a database in Access which stores data for a small company. Sometimes we need to add similar information to different tables....
10
by: Marizel | last post by:
I'm not sure there's an easy solution to this, but thought I'd ask. I often find myself with a query which I'd like to reuse, but with a different datasource. These datasources generally have...
0
by: elmo | last post by:
Hi, I have a transaction table that I need to update from a from. The form should be able to display information from different tables. I have a Learner table with Learner information. I also...
20
by: Dennis Gearon | last post by:
I am working on a design where a location for something can have: Fully qualified address with even building names, room numbers, and booth numbers. **-OR-** GPS location **-OR-** Both ...
0
by: Jerms | last post by:
Hello all, I've been using this site quite a bit since starting my project and have found it very helpful. I have run into a roadblock though that I cant seem to scrounge up a solution to. I...
7
by: clloyd | last post by:
I am trying to generate an email that is gathering information from two different tables. I keep getting an error message that it can not find my CustomerNo. Does anyone have any ideas? Private...
6
HaLo2FrEeEk
by: HaLo2FrEeEk | last post by:
I have two different tables which havea different number of columns. One of the tables gets a new row every day and is populated with a st of 4 IDs from another table, along with today's date and an...
2
by: HumbleAprentice | last post by:
Hi All, I am new to PHP and mysql and would greatly appreciate your help. I am trying to learn PHP and mysql so I decided to create a project to help me do so. I created a registration form...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.