How can simplify my database?
I am working on a project in which I have generated a unique id of a customer with the customer's Last name's first letter. And stored开发者_如何学C it in a database in different tables as if customer's name starting with a then the whole information of the customer will stored in Registration_A table. As such I have created tables of Registration up to Z. But retrieving if data with such structure is quiet difficult. can you suggest me another method to save data so that retrieving become more flexible?
Put all of your registration data into one table. There's absolutely no need for you to break it into alphabetical pieces like that unless you have some serious performance issues.
When querying for registration data, use SQL's WHERE
clause to narrow down your results.
You have to merge this to one table ´Registration´, then let the database care about unique ids. This depends on your database, but searching for PRIMARY KEY
or AUTO INCREMENT
should give you lots of results.
If you have done the the splitting because of performance reasons, you can add a Index
on the users last name.
精彩评论