I have a set of SQL like and I would like to convert it to function or a stored procedure in an automated way: create table test as select * from test1; DELETE FROM test WHERE e_id LIKE ‘%00-01’;…
How to create a collection and insert values in a table with the collection?
Hey I am creating a database to store some information about a sport club, where I have trainers and athletes, but when I am trying to insert trainers(entrenadors) to the table that errors appears: …
Average Sal of employee dept excluding his salary
The avg salary of peers expects the employee itself(that is, for each employee its peer would be everyone in the same department as the employee but excluding the employee himself). We have two …
How to access a table using a variable name in sql query
I have multiple tables in my database named teacher1, teacher2…. I am trying to access them using a variable $id. I have written down the following code. $query = “SELECT * FROM table.$id”; How …
Using LIKE statement in PHP
I am setting up a new API, I am wanting to display selected info from a Mysql database with a ‘SELECT columns WHERE column LIKE % ?’, but I’am getting error in ‘%’ symbol, where I must insert ‘%’ …
Creating a trigger inside another trigger. ORA-00604: error occurred at recursive SQL level 1
I’m trying to create a DDL trigger AFTER CREATE which would make another trigger when called. So I wrote some test code, here it is: CREATE OR REPLACE TRIGGER Test_Trigger AFTER CREATE ON SCHEMA …
sql query to select records from mysql
Can suggest me the best way to select records from MySQL customer ——– id bed_id status 1 1 vocated 2 1 booked 3 2 vocated bed —– id name 1 lower 2 middle …
SELECT subCategory which equals parentCategory = value from outer table
I have a products table and I need to put discount on some products from a given sub category, which has parent category in another table. TABLE products: category_id sku discount —-…
Sql stored procedure Count equity turnover for brooker
I’m trying to count a brookers qty turnover, total buy sum, total sell sum. The problem is when the buyer is also the seller in which case the brooker has turnover the equities once on the buy side …
Nested SELECT “works” when using nonexistant column – why?
folks, I have the following query in SQLite: select license, username from check_table where ( username not in ( select username from Address ) ) order by license, username; Address …