Im getting a syntax error 1064 in mysqlworkbench for the stored procedure im trying to create. the stored procedure is based on a view i created. this is my view based on dataset(https://www.kaggle.com/gregorut/videogamesales) : and this is the stored procedure based on View with one parameter: I did the stor…
In SQL Server: Create Pivot Table with each Date as a own column
I have a table containing 4 different identifiers, a date and a numeric column like: from which I want to create a kind of pivot table like the following: This should be created for past 10 days or so, so it CRUCIAL I don’t have to set the dates manually. I tried something with PIVOT but that didn’…
Database table design for ‘availability’ within time ranges per day
I am working on a meeting scheduling web-app, where a person can share their availability for specific time ranges within the day. E.g. A user is available 3 time-ranges within the day, from 09:10 to 10:00, 13:00 to 14:00 and 16:30 to 17:15. This can go on for 6 days per week, from Monday to Saturday. What I …
Why is SQLITE taking forever on a simple count query?
I have a set of SQLITE tables that adds up to 7 GB on disk. The particular table I am querying (FQ) has approximately 50 columns, and 3 million rows. I am querying from the sqlite3 interactive shell (…
SQL – Select rows partially depending on another table
I am very new to the database and queries. I am not sure if this is very basic. Please help me to find a solution. I have two tables – subscription and customer with primary keys as subscription_id and customer_id respectively. the customer_id is foreign key pointing to customer table customer_id column…
How to make a PG function and trigger from SQL syntax?
I’m currently using this SQL syntax to update all records of one table after checking values in another table: UPDATE schema.table1 AS c SET field1 = ‘SI’ FROM schema.table2 AS s WHERE c.specie = s….
How can I create a column with time HH:MM from a timestamp column with time HH:MM:SS in my dataset [closed]
How can I create a column with time HH:MM from a timestamp column with time HH:MM:SS in my dataset
SQL How to ask for a value multiply times in an Query [closed]
Good evening folks! Following Problem, I have three tables: Create TABLE Suppliers ( SID integer, sname varchar(50), adress varchar(50), PRIMARY KEY (SID) ) Create TABLE Parts ( PID integer, pname …
SQL Function to Look at near-by Intervals of data
I am trying to determine if there is some sort of SQL function that would allow me to look at nearby intervals of data to aggregate them into other aggregate functions. My current data looks something like the following and occurs every 5 minutes with a single entry per day for a given time period per entity.…
How to list out management levels from Postgres table
I have a table with the following fields: Id, manager_id, and candidate_name The manager_id will point at id which allows me to reference the management chain. I want to generate an output like the …