How do I write a query that compares a primary key to a foreign key to see if they refer to the same record? I was thinking something like: SELECT BookID from books WHERE BookID = Publisher, but …
How do I get rid of this SQL error from the end of my query when inserting within a procedure?
Not sure if this is even possible but im getting a weird error at the end of my query. Any idea why? Here is the code: CREATE OR REPLACE PROCEDURE NewUser (g_name VARCHAR, f_name VARCHAR, u_password …
My MySQL select shows only 1 result instead of all that I chose
I have a problem with this mysql exercise, could someone help me so it displays all the records I want, because now it only takes a value from the column tytul and it gives the max, min and avg from …
Missing records in a -6 table matrix
i would be grateful for any help in solving the problem below. I’ve restated the problem following a request for some data I have the following sql tables qual = List of qualification codes (qualcode,…
How can I relate a row with several other rows in the same table? [closed]
In my situation, I have a table of postcodes. I want each row to have a list of surrounding postcodes. With the app I’m developing, I want to be able to search by a postcode/suburb and include …
insert/update data from one column to another with on conflict update, only those that have different values for specific fields?
I have two columns products/tmp_products with following specification (id bigint primary key ,price int not null,quantity int not null ,lastupdate timestamp) I want sql to &…
SELECT requiring multiple joins with one to many tables in PostgreSQL [closed]
Toy example: I have a database schema shown in this EDR diagram: Student one-to-many with StudyGroup StudyGroup one-to-many with Borrowed Borrowed one-to-many with Books. I want to get all books …
select limit in sql
I wrote this query but gives me an error at line 15 (limit clause). we have 3 tables, state, email, and receiver. CREATE PROCEDURE `inbox`(IN `page_size` INT,IN `page_number` INT) BEGIN set @curr …
Can’t access to schema in postgres
Lets say that I made this “simple” implementation of a DB in Postgres postgres=# CREATE ROLE my_role; CREATE DATABASE my_db; GRANT ALL ON DATABASE my_db TO my_role; …
In pgadmin EXPLAIN ANALYSE , exclusive vs inclusive
As showed below, I tried to optimise my query based on EXPLAIN ANALYSE function of Pgadmin. Can someone experienced with it tell me the difference between INCLUSIVE and EXCLUSIVE in Timings? And why …