Skip to content

Tag: mysql

Are there faster alternatives to the CROSS JOIN model used below?

All I know is CROSS JOIN, but sometimes I look on StackOverflow for query support and find some answer mentioning that this is not the best join. I don’t know if they’re saying that due to an opinion on what would be easier on the developer, or if CROSS JOIN is functionally inferior to its JOIN br…

Granting privileges to a user named “Grant”?

How do I grant permissions to a user who is named “Grant”? It throws an error. Error: ‘Grant’ is not valid at this position. Expecting an identifier. Answer You have to use backticks when using reserved keywords or identifiers with otherwise illegal characters as identifiers Apostrophe…

How can I query my table to group it by 2 fields in mySQL?

I’m stuck. I’m trying to query one of my tables to obtain the maximum ‘canister_change_date’ with grouped pairs ‘canister_type’ and ‘test_cell’. I’ve put together a table with some dummy data (below) If you want the create table schema, let me know and I&#…

SQL (MYSQL, Postgres) Lookup/report table

I’m basically making a lookup table for my three tables but its not doing what I want. Those 3 tables were created by loading 3 different csv files. What I’m trying to do is inserting the ID’s from those tables into the lookup one. This is what I keep getting: What I need is: I kind of get w…

How to extract the information from JSon in MYSQL

I have Sample Data I’m getting Data Like this : I’m trying to get output like this : Can any one Suggest me . Answer In MySQL 8.0, you can use json_table() for this: Or if you want the results as a scalar value: In earlier versions, you would typically use a table of numbers and json_extract():