I have the following tables: An image can have a country (or not) or a place (or not). Let’s say that I have a record in the country table: And places in the place table: I want to tag an image with the country Spain and a place Barcelona In the image table, should I enter the country_id and the
Tag: sql
How I can select random amount of rows based on varios criterias?
I have a table that has 3 main categories: age, city and gender. The gender column is boolean. The age category is in the following range: [’18-25′,’26-35′,’36-45′,’46-55′,’56-65′,’66-75′,’75+’] The …
How to fetch all data without the “out of range” SQL Exception?
I’m extracting data from a database, and I’m getting com.microsoft.sqlserver.jdbc.SQLServerException: The index 15 is out of range. during RunTime. My connection class is executed as the following: While I understand why it’s happening, in this while loop: I don’t quite understand how …
Division of 2 values in mysql
Hello I’m a newbie in SQL. I have a table of workers and I want to calculate the avg num of female workers. I want to divide 2 tables that I create, but when I do the division the value of the new …
Select longest duration time (data type field) and client name SQL
I have these tables: CREATE TABLE Client ( client_id NUMBER(10) NOT NULL PRIMARY KEY, name VARCHAR(50) NOT NULL, address VARCHAR(50) NOT NULL ); CREATE TABLE Projects ( project_id …
Postres SQL select with GROUP BY and COUNT
i have this SQL select SELECT t.debtor_account, COUNT(t.debtor_account) FROM transaction t GROUP BY t.debtor_account HAVING COUNT(t.debtor_account) > 2; which work, but i need select all from …
Which SQL function I should use to repeat existing row values for a new column
I have a table with 2 column studentID and StudentName and department. StudenID StudentName Department 1 john IT 2 Michael Finance 3 Josh chemical I …
Trigger is not called on update table in oracle
I’m trying to make a trigger that updates the ID_ABONAMENT from the CONTRACTE table, when the ABONATI table is updated. The problem is that the trigger is not called when I update a row in the ABONATI …
How to exclude rows with similar columns?
There is a table: | date | action | issue_id | | 2020-12-14 | close | 1 | | 2020-12-15 | close | 1 | | 2020-12-16 | close | 1 | | 2020-12-14 | close | 2 | …
Select sqlite android
I have a query with a condition but it is returning an empty result even though I have the data that matches these conditions. I am a beginner, so I’m not sure if this query is correct. public Cursor …