First off, I am not an SQL coder. I am trying to select information from 2 different tables in the same database. Table 1 is called trans and has 3 columns: Table 2 is called cust and has multiple columns: The SELECT statement that I’m trying to write will pull data from both tables. I THINK I need to u…
Tag: mysql
Canonical way to store reciprocal data sql
I got a lot of instances of the same Class. Now these objects can be linked and this link can have a weight. Like in an undirected graph. Now I want to store the relationship between each two objects in my mysql database. Data looks like this I could do create a table with this structure: object1_id | object2…
Multiple dynamic FIND_IN_SET searches
So, I have an array like this in my programming language: And I have a MySQL database table like this: Unfortunately, I cannot change the table to be more relational (yet). I want to pull out how many times an item in my array is present in the database value column. Now, the obvious way to do this would be
SQL syntax for characters not in brackets
I’m accessing a Microsoft Access database using ODBC. According to the w3schools SQL tutorial, the ANSI-92 wildcard for “any character not in brackets” should be ^. However, their own …
SQL query filter down to only applicable rows
How would I select a query like this? I am a bit confused because this would return nothing since any of the rows do not fulfill any of the “where clauses”.. What I would like is the answer …
How to create procedure in mysql
I am creating a procedure in mysql but I am facing issues with the required result and now I am in a total mess. Please help me! The requirements is this: Get the Top 20 entries from the table, for the current day. By Top 20 entries, they should be the ones that occurred most often during the day –
How to store user content while avoiding XSS vulnerabilities
I know similar questions have been asked but I am struggling to work out how to do it. I am building a CMS, rather primitive right now, but it’s as a learning exercise; in a production site, I would use an existing solution for sure. I would like to take user input, which can be styled in a WYSIWYG edit…
Quick way to find a word using a SQL query
My current code is to try to find 2 words “Red Table” in Title: The problem is, this is so slow! I even put the status “Index” to the column Title. I just want to search for multiple words in one (I would prefer in title AND description), but obviously I can’t use LIKE because it…
MySQL: Extract Select in “Module”
Assuming the following SQL statement: The there a way to modularize the statement, for instance, extract the second select statement in a file and call this file instead of writing the whole query? Answer I found a way to reuse SQL. Its possible via SQL-Functions and SQL-Procedures
Find table name on the database using stored procedure on MySql 8.0.17
This is a list name of tables stored a database MySql version 8.0.17 The table name storage policy is Table_ Western alphabet letter (issued by an algorithm that recognizes the connected user, privileges, etc.)_ Random number_ Month Number_ Current Year I need find on the database MySql all the table for firs…