Skip to content
Advertisement

How to get address by user’s id oracle

In my project, front end needs, following JSON data with this format. So I Created two table for user and their addresses,

So I plan to going with this table structure,

USER_TABLE

USER_ADDRESS

Address table I created this way because, each user have two addresses, one is permanent and other one is correspondence. So is this good table structure to handle this? if yes, then I need to get following output from sql query, How can I do it?

enter image description here

Advertisement

Answer

As per my experience, Your table structure seems correct to me. You can try pivoting the address table first and then join the table with user_table –

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement