Skip to content

Avoiding redundancy in database tables sql mysql

I have a question please. I am developing an online mall website. I have an orders table.. I have put the product_id as an attribute in order to know which product is ordered. In the customer’s purchase history page, I need to present all the orders purchased by the customer, including the product title…

How to get the row index in SQLite3?

I have created a table that has a column of registration number as primary key. I have created row_id using row_number() that is ordered by the primary key. How can i search a registration number and get the row_id along with other information of that row? Answer If you have created the column row_id like: th…

How to join tables based on certain condition? SQL

There are three tables A,B,C Table A has columns [ID], [flag], [many other columns] Table B has columns [ID], [column subset of Table A] Table C has columns [ID], [same column subset as Table B (thus also a subset of Table A), however with different values] I want to join Table A & Table B if Flag = &#821…

How do I do NOT CONTAINS?

I’m having difficulties with a question on an assignment and writing the correct query. I’ve been at it for days, and it’s due soon. I’m trying to show all project numbers that do not contain employee id’s of 114 and 113 (the application designers). Looking at the table data, I c…