I have a table named Dates, let’s just say with two columns for simplicity purposes. One is labeled “date” and that column is of a date data type, and the other one is labeled timestamp and …
Tag: database
Database (1064) SQLSTATE[42000]: Syntax error | Importing using phpmydirectory
So, we use a script called “phpmydirectory”, and at this point it’s pretty outdated. It wasn’t designed to work on PHP 7+ or MySQL 5.7+ but we’re mostly making it work. Part of the script, …
PostgreSQL – Cast generated column type
I tried to create generated column from other JSON type column with ALTER TABLE “Invoice” ADD COLUMN created Integer GENERATED ALWAYS AS (data ->> ‘created’) STORED; When I execute this I get error ERROR: column “created” is of type integer but default expression is of type text HINT: You will need to rewrite or cast the expression. SQL state: 42804
SQL Select Statement – Automation Anywhere
I am trying to write an SQL select statement where i only extract two columns from a csv which has been connected as a CSV. The select statement query i am using is: Which extracts all data in the table as expected, I wish to only extract data in columns with headers: The below line of code throws a syntax
How to I use the LIKE operator?
I’m doing a query using the LIKE operator, but it doesn’t work. When I run the query, there’s no results, but it says “Query executed successfully”. Does anyone know why? This is what I have …
How to structure the database to avoid duplicates in a table
I am doing this exercise where I have to build an sql database (MySql) to store information on private lessons offered by teachers. These are the rules: There is just one predifined week with slot times from Monday to Friday (15-19) Each teacher can teach 1 or more courses Each course can be teached by multiple teachers One user can
How can I use an SQL query’s result for the WHERE clause of another query?
Okay, basically I have a table that contains statements like: I would like to use the contents from this table to generate other tables that fulfill the conditions expressed in this one. So I would need to make it something like But the last part of the where has to come from the first table. Right now what I’m trying
How to find a non-existing value from another table in mysql using ONE single QUERY
I want to find number of types of produce of each farmer, names of farmer and the total number of produces but I am getting stuck in the part trying to display farmers who do not produce anything in the supplies and then in another query I want to extend it to display farmers with highest produces but without using
How do I remove results based on conditions to calculate an average
I have the schema below. A quick explanation of it is: bob rated up 5/5 james rated up 1/5 macy rated up 5/5 The logic: If I am personA, look up everyone I have blocked. Look up all the movie …
Why am I violating an integrity constraint? (ORA-02291)
When I try to alter one of my tables to set one of it’s rows as a foreign key, I get the following error: “ORA-02291: integrity constraint (SYSTEM.M_FRAN_FK) violated – parent key not found” This error only occurs when I insert a row into the database with a none-null value. I’m trying to understand why it’s doing this and what