my table looks something like this i have a function, which return 1to3 int value representing effect1,effect2,effect3 and “id” i am trying to increment value of each effect by 1 when my function’s returning “id” matches the “id” from my dataset otherwise creates new …
Tag: database
How to do update/migration of data, with help of generic query
I am in middle of trying to get better with sql, but I have some issue/question with one of my exercies. So I thought about this kind of following situation. I have three tables: STUDENT COURSE STUDENT_COURSE But after some time I have requirments to divide courses into more specific names. So in COURSE table…
How to “hide” a row in Oracle SQL database but not delete it
Is there a way to “hide” a row in Oracle SQL database without deleting it, So that it is still in the database but does not show up on the webpage as a search result? For example, I want to hide a specific city in my database from being displayed in the results when searching for cities on the web…
How to join one column multiple times to many columns? – SQL
I have two tables like: I want an output like: I think this will require JOIN and UNION ALL, but I can’t figure out how exactly to put everything together. I’m confused because we’ll need to join multiple times per row. Would appreciate any help, thanks Answer You can do: However, I would sa…
django ‘dict’ object has no attribute ‘job_id’
I’ve got this code: Even though value() is defined, I get the error ‘dict’ object has no attribute ‘job_id’ I guess the error will also be for pass_count, skip_count and fail_count What am I supposed to do here? Answer Your query does not return a queryset with object instances, …
How to structure my database model for a simple web application and organize my SQL data model
I am working on a web app. I have a question about the SQL parts. I am currently creating a food rating interface. The user should be able to login and then rate the food. Currently I use a custom database (users) for the login page. I also use a separate database (review) for the reviews. my current database…
How to remove values from an array that exist in another array?
In PostgreSQL I have a table (Table) that contains an id column (ID) and another column (Values) that contains an array of strings. I have a select query (SelectQuery) that gets me an ID that matches Table.ID, as well as an array of values (RemoveValues). I would like to now remove from the Values array, any …
Efficient way to join multiple columns to the same column? – SQL
I have a bunch of tables combined together, which each have a column containing some form of user_id. This leads to 12 user_id columns in total. I want to join each of these user_id columns with a user_id column in a mapping table in order to retrieve the username for each of these user ids. So (assuming I ha…
Fill NULL and get distinct record
I am ingesting data from two different source (source A and source B). Although data may be coming from two different sources, there is a possibility that an ID for a record may exist in both sources. The problem is, there are cases when one source is more complete than the other. In the example below, Source…
How do I get the data extracted from API to my database
I am currently working on a project to build a database on professor’s research paper database. This is my first time building a database(never had experience with MYSQL) and I am learning as I am doing it. I was able to use an api to get the data, for example: {“authorId”: “1773022…