To which should add shipping_charges? [closed] - mysql

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I'm sorry it seems be weird! but I'm so confused! bear with me:)
I'm new with E-commerce I just create simple app via Laravel, I design this database for it:
I got in my mind tow questions:
I'm confused with where should I add shipping_charges column for order in which table?!
I have governorates(cities) so shipping_charges in the capital of my country should be 5$ and others cities should be 10$. How can handle the price of the cities?

I think you have to put shipping_charges in governorates table because it belongs to it. You can make separate table governorate_to_shipping but it's not neccessary.
In order you have address_id in addresses you have governorate_id so you can join this tables to governorates table and get shipping_charge from it.

Related

Problems with the definition of an entity in ER diagram [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have to build the conceptual model for a school, which has a Cafe inside it. The school wants to control the profits which derive from the Cafe.
What could be the best way to represent this with an er-diagram?
I tried to create the entity "CAFE", with attributes NameActivity, Profits. But I don't think that makes sense
One possible conceptual model could be this
The Cafe generates orders and every orders contains different order rows (cappuccino, latte, and so on). You can retrive the profit simply adding the cost of each order row.

How to get a specific row of data for mysql with specification of company and agent [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
How to retrieve all the data pertaining to company name and agent from mysql? How to write the query statement?
Have you tried this?
SELECT *
FROM agent_info
WHERE policyCompany = 'Avia' and policyAgent = 'Ron';
I have to guess because you didn't tell us much about your tables, but this might work.
SELECT policyCompany,
GROUP_CONCAT(DISTINCT policyAgent ORDER BY policyAgent) agents
FROM mytable
GROUP BY policyCompany
You can read about GROUP_CONCAT() here.

How to achieve synchronization in database level? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm developing an airline reservation system as my semester project. Here, when one customer books a seat in a specific aircraft, I need to prevent another customer from booking that seat at the same time. I know how to do this in back-end level using synchronization. I need to know whether there is a way to do this in database level. If so, could you please point me in some direction
You can create unique constraint for 2 columns in table like (flight_id, seat_id)

How to design table to store user settings? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
If its just for turning on and off a basic feature, this should be ok?
USER_SETTINGS
-Id
-UserId
-SettingId
-IsEnabled
The problem is some settings require various fields...this could work, but is there a better way to do this?
USER_SETTINGS
-Id
-UserId
-SettingId
-XMLSettings (XML data of settings)
A. you can use nested table or object instead of XML on Oracle
B. you can create another table USER_SETTING_FIELD, which has foreign key to USER_SETTINGS
C. you can use simple string column with the format "field1:value1;field2:value2"
D. you can use extra SettingId for each field

How to find corrent name for middle table in many-to-many relationship [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
This is not technical question, anyway it's related to good and clean code.
If I had tables articles and tags, I know the taggings can be good choice for middle table name.
What about other names? Like many-to-many in articles and cateogories. What's the best name for table between these two?
Is there any good approach? Or is it a question of English grammar? Please let me know.
Best approach in my opinion would be to combine the two model names into one: ArticleTag (TagArticle makes less sense here). If you call it Taggings, then you (or someone maintaining your code / database) won't realise the relationship right away.
Same for ArticleCategory (CategoryArticle makes less sense).