Hello everyone, I’ve got a problem with my php code. I keep getting this error 0 1 2 3Connection failed: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens. As I understand it means that the number of parameters doesn’t match. I rewrited it many ti…
Tag: sql
ORACLE SQL find row with max date for each grouping
I am trying to write a query which will return only the rows, which time has the greatest value for each id Result should look like: I tried grouping by id but I don’t know how to sort after that and pick only the top result. Answer You can use window functions: An alternative method is a correlated sub…
Query to list users who have answered similarly to questions as the specified user
I’m making a project in which users answer questions with yes/no choices and an option of must-match, e.g.: Question 1) Stack Overflow is helpful? [Yes / No] [MustMatch] Question 2) Hills are better than beaches? [Yes / No] [MustMatch] etc. Users can skip questions if they want. I need MySQL query to ca…
List the name of all the directors who have not directed a movie since a certain year
I’m trying to learn PostgreSQL with the imdb database and I can’t seem to figure out how to list the directors who have not directed a movie since a particular year. I have three tables to work with Table movie with mov_id, mov_title, mov_year Table director with dir_id, dir_name Table movie_direc…
Creating JDBC Application
I have this piece of code: but I have this error: Answer Since you commented out your print statement, your loop is now closing the connection (and all of its dependent resources). Your code, without the commented out line:
SQL update with more than 2 records
I’m trying to update column in this table: Expected result: And this is my update query – I get an error and I’m not sure where the issue comes from. Thank you. Error Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when…
Why can’t I use a local variable after a SQL query in Node.js?
I have to select all tags available in the database, so I could use them in my function, but I can’t use the variable after I assigned a value to the variable in the callback function of the query, why? Code which is not working: However this works: but why? I want to use the variable tags after that qu…
How can I convert an int (UNIX timestamp) to datetime in SQLite?
I have to create a table in SQL(I am using IntelliJ and Java), and the table must respect the following restrictions. The table will contain the following columns: title – needs to be able to store letters, digits, and special characters news_description – needs to be able to store the text of the…
How to convert date : Sep 26 00:15:00 2020 in YYYY/MM/DD HH24:MI:SS’ format in oracle sql
Error while converting Looking for solutions Answer With TO_DATE(), you want to convert a string – ‘Sep 26 00:15:00’ to an Oracle DATE type – that is a type that counts, internally, the number of seconds since an epoch date. In Unix, that would be ‘1970-01-01 00:00:00’, in …
How can i write hired the same month employees and order?
Sql, which gives the number of employees hired in the same month (or year) grouped and sequentially on date basis. I tried to write this code, but i didn’t find same hired and order. Answer This is how I understood the question. Sample data: Employed in the same month: Hired in the same year: