I am in a mysql terminal and I created a user. I tried to grant the user privileges with And got the error: So I tried And got So I am trying to grant privileges to a user but I am stuck. Answer Try this: Make sure the password used for the user complies with the password policy
Tag: mariadb
Create view with one row for each column in a table
I have a table that looks like this: I need a view with 3 columns, that has a row for each column in the original table, so it would look like this: The values on the currency column in the view need to be created by me (the EUR, JPY, etc) and are fixed values; I need to get the
How to list 3 largest numbers from table in SQL?
I’m trying to unite two bits of SQL codes and list three largest numbers from it. Here is table relation diagram Query #1: Query #2: My final code shows the full list of all first and second names, simply adding largest number to all of them from orders table. How can I modify it to make it show three names
MariaDB trigger to perform an UPDATE and then an INSERT on the same table
I currently have an account table and an account_audit table (all codes are available on a fiddle here). I have two triggers that insert records into the account_audit table based on data inserted into the account table. 1 trigger is an ON INSERT trigger which just inserts these values – that works fine. So, after inserting 2 records on my
How to insert an array value to an existing JSON document?
Given a column containing a JSON document, I can use JSON_SET() to set a key in the JSON document to a value. Supported values are null, true, false, numbers and strings; but I can’t figure out how to set an array. The example in the documentation (for JSON_INSERT(), but it works the same) weirdly shows how a naive user might
Get the newest two line per product and get price and date
I have made a query that extract the two newest lines per product. Each row shows id, productnumber, pricechangedate, price. Id Prod number Date Price Rank Order 71582 0071807993 2021-10-15 18:06:22 220.79 1 60533 0071807993 2021-10-15 13:22:46 220.79 2 Is it possible to some how concatenate these rows to show: Prod number Newest Date Newest Price Second Newest Date Second
join tables from different databases only adding most recent date SQL
I am joining lots of data to handle dynamic/complex querying. The following is just a part of what I’m doing. I found a solution, then I think I tweaked it and lost it. Database Structure: oauth.users order.orders ( I know bad naming, I didn’t create the database) (customer_id = user.id) I want to join only the most recent date This
As a result of the Euclidean distance many images are mistakenly identified as identical
Sorry for my bad english, i have a small database that contains hashes of photos, when I try to find similar photos to the one below: for which the following hash was calculated: “0f3f2764ecc482c2” using the method average_hash() The system finds a very large number of collisions, below is an example of photos that were identified as completely identical: The
MariaDB, How to copy existing records using insert?
I have a lot of existing records which I want to copy using an INSERT, for example if I have a query: The common key is biDataset, the primary key in this table is biPK which is auto incremented on each insert. Here is the table structure: What I want to do is copy all the records that exist where
SQL MAX() function seems to truncate results
I have the following basic 3 Table Structure in mariadb/mysql. This simple SELECT returns incomplete records. I reduced the output of all follwing examples to a single dataset to avoid unnecessary clutter. The IP_LONG column is missing the follwing for example… My guess is, it has something to do with the MAX() Function has troubles with mixed Content in the