Question Answering with YouTube Videos Using RAG in LangChain Programming Computer Science by usmanmalik57 In previous articles, I explained how to use natural language to interact with [PDF documents](https://www.daniweb.com/programming/computer-science/tutorials/541732/paris-olympics-ticket-information-chatbot-with-memory-using-langchain) and [SQL databases](https://www.daniweb.com/programming/computer-science/tutorials/541771/using-natural-language-… Re: How to query database using variable and get all results not just one row Programming Web Development by Mikekelvin To ensure that you're retrieving all records associated with the current user, you need to make sure that your query accurately filters the data based on the user's identifier (variable_name). Here's how you can modify your query to achieve this: // Assuming $currentUser holds the identifier of the current user // Query database to retrieve … Re: How to query database using variable and get all results not just one row Programming Web Development by Chris_103 To retrieve all records associated with the current user, you can use the fetchAll() method instead of fetch(). Here's how you can modify your code: ```php // Query database to retrieve records associated with the user $sql = "SELECT * FROM table_name WHERE variable_name = :variable_name"; $stmt = $conn->prepare($sql); $stmt->… Using Natural Language to Query SQL Databases with Python LangChain Module Programming Computer Science by usmanmalik57 The advent of large language models (LLM) has replaced complex scripts with natural language for automating various tasks. You can now use LLM to interact with your databases using natural language, which makes life easier for people who do not have sufficient SQL knowledge. In this article, you will learn how to retrieve information from SQL … Paris Olympics Ticket Information Chatbot with Memory Using LangChain Programming Computer Science by usmanmalik57 In my previous article, I explained how I developed a simple chatbot using LangChain and Chat-GPT that can answer queries related to Paris Olympics ticket prices. However, one major drawback with that chatbot is that it can only generate a single response based on user queries. It can not answer follow-up questions. In short, the chatbot has no … Paris Olympics Chatbot- Get Ticket Information Using Chat-GPT and LangChain Programming Computer Science by usmanmalik57 I was searching for Paris Olympics ticket prices for tennis games recently. The official website directs you to a [PDF document](https://tickets.paris2024.org/obj/media/FR-Paris2024/ticket-prices.pdf) containing ticket prices and venues for all the games. However, I found the PDF document to be very hard to navigate. To make things easier, I … Re: Improve HAVING BY performance Programming Databases by toneewa I'm a little late to the party, however, I want to share my experience learning MySQL in the past day. I setup a server, a database, and wrote a C++ program to connect to it. It measures the times for 3 SELECTs. The whole product list, using HAVING, and WHERE. I also tested reversing the orders. Query execution time: 0.0002336 seconds … Re: Improve HAVING BY performance Programming Databases by toneewa Correct. It wasn't about displaying the results, but to measure the different clauses. I'm not impressed by only 95 INSERTs/sec, and a maximum write speed of 175 KB/s for importing data. Increasing to 50K shows WHERE to be faster. 50K: WHERE Query execution time: 0.0599129 seconds HAVING Query execution time: 0.0621748 … Re: Improve HAVING BY performance Programming Databases by toneewa I know when you don't use aggregate calculations use WHERE. Producing the same results can be done. I added another test with MAX(Price). With a database over 305K rows, 3 columns, MySQL Workbench is unstable importing. Took over 2 hours. WHERE is faster, and should be used, when no functions are needed. WHERE Query execution time: 0.… Re: Improve HAVING BY performance Programming Databases by Biiim > I don't have experience with MariaDB, but in MySQL, something like that will work as long as I do SELECT sum(points) AS total FROM ... HAVING total > 10. Is that what you were getting at? Kind of, MariaDB is a fork of MySQL from around 2009 or something like that, MySQL 5.* and the creator continued developing MariaDB and Oracle took … Re: Improve HAVING BY performance Programming Databases by Biiim > INSERT INTO electronics.products(ProductID, ProductName, Price) VALUES ('1','capacitors', 2.50), ('2','resistors', 4.50), ('3','rectifiers', 7.50), ('4','diodes', 10.00), ('5','ICs', 25.00), ... ('50000','...', ...); I don't see any mention of an index on it & your benchmark indicates you don't have one: ALTER TABLE `… Re: Improve HAVING BY performance Programming Databases by Biiim I realise this has been marked as solved, but I wanted to make it known that the HAVING clause runs on the returned result set of your query, which as you say has no indexes on it as it is just a temporarily created result set - but has the benefit of allowing you do do some simple post-processing on the result set. (This is for MariaDB at least)… Re: Improve HAVING BY performance Programming Databases by Dani But you're not comparing apples to apples. Your WHERE query and your HAVING query perform different calculations and do different things. In one, you're plucking out all the rows with a price greater than $4, and then calculating an average price for each product. In the other, you're plucking out *all* rows, calculating an average price for each … Re: Improve HAVING BY performance Programming Databases by Dani > I know that in my experience, OR's are very bad for speed you can get away with a few but they can get very bad when they stop the whole query making use of one of the main indexes, you can actually speed it up by moving the or's into the HAVING usually. Thank you for that tip! I never thought of that, but it totally makes sense!! > … Re: Improve HAVING BY performance Programming Databases by Dani I think you might be missing my point. If you’re fetching different data, there’s no way of saying whether where or having is faster. You would need to write queries that use each, but retrieve the same data, to see which is faster for a use case. Even then, it totally depends on the data in the database itself. The same query can be fast for some … Re: Improve HAVING BY performance Programming Databases by toneewa I added your mentioned alter table index. Took 4.375 secs in MySQL Workbench. It did speed up the results. I'll have to try another method of importing to see if I can improve this. I also ommitted the overhead of converting variables for display output measurements, because they were included in the C++ times. If we were to compare the two, it as … Re: DaniWeb Auto Answer A.I. feature Community Center Meta DaniWeb by toneewa I did some sample testing, and parsed a thread topic for the dataset. Reducing the footprint from 220kb to 26.5kb. All in 0.43 seconds. It doesn't use any API. Just the patterns I saw in the code. It took another 6 seconds to embed too Chat with RTX. Then, not deducting for the deleted threads, this could be a lot smaller, and quicker than … Re: How to query database using variable and get all results not just one row Programming Web Development by Biiim logically, it would be because `WHERE variable_name = :variable_name` matches 1 row in your table maybe try a `var_dump(str_replace(':variable_name',"'some_value'",$sql));var_dump($records);`? run the sql on whichever way you use to access your DB directly I don't use PDO so i'm not too familiar on how it returns results, either … How to query database using variable and get all results not just one row Programming Web Development by nander Hello I am trying to query a database to show records only for the current user using variable I get the correct data but only 1 row with results any guidance? // Query database to retrieve records associated with the user $sql = "SELECT * FROM table_name WHERE variable_name = :variable_name"; $stmt = $conn->prepare($sql); $stmt… Retrieval Augmented Generation (RAG) with Google Gemma From HuggingFace Programming Computer Science by usmanmalik57 In a previous article, I explained [how to fine-tune Google's Gemma model for text classification](https://www.daniweb.com/programming/computer-science/tutorials/541544/fine-tuning-google-gemma-model-for-text-classification-in-python). In this article, I will explain how you can improve performance of a pretrained large language model (LLM) using … PDF Image Table Extractor Web App with Google Gemini Pro and Streamlit Programming Computer Science by usmanmalik57 In my previous article, I explained [how to convert PDF image to CSV using Multimodal Google Gemini Pro](https://www.daniweb.com/programming/computer-science/tutorials/541365/converting-pdf-image-to-csv-using-multimodal-google-gemini-pro). To do so, I wrote a Python script that passes text command to [Google Gemino Pro](https://blog.google/… Use of the Word ‘Tapestry’ in Web News More Than Doubled Last Year Community Center by Johannes C. **Tracing AI-generated content in online news articles with corpus linguistics** ![tapestry-header.JPG](https://static.daniweb.com/attachments/4/c8a5b32abaf78b39bdcb75f328580e4a.JPG) *A query in the 'News on the Web' Corpus reveals that the use of the word 'tapestry' in online articles has more than doubled last year – from 3,085 instances in … Converting PDF Image to CSV Using Multimodal Google Gemini Pro Programming Computer Science by usmanmalik57 In this article, you will learn to use [Google Gemini Pro](https://blog.google/technology/ai/google-gemini-ai/), a state-of-the-art multimodal generative model, to extract information from PDF and convert it to CSV files. You will use a simple text prompt to tell Google Gemini Pro about the information you want to extract. This is a valuable skill … Claude 3 Opus Vs. Google Gemini Vs. GPT-4 for Zero-Shot Text Classification Programming Computer Science by usmanmalik57 On March 4, 2024, [Anthropic](https://www.anthropic.com/) launched the [Claude 3 family of large language models](https://www.anthropic.com/news/claude-3-family). Anthropic claimed that its Claude 3 Opus model outperforms GPT-4 on various benchmarks. Intrigued by Anthropic's claim, I performed a simple test to compare the performances of Claude … Re: Improve HAVING BY performance Programming Databases by Reverend Jim I have a friend who spent the better part of a career doing SQL. I wrote up your question and sent it off to him. Just for sh!ts and giggles, he decided to feed it to ChatGPT first. He said that what he got back was what he would have written if he spent a lot of time researching. Here is what ChatGPT said... >Yes, you're correct that … Re: Improve HAVING BY performance Programming Databases by pritaeas Perhaps a smarter someone on this forum can help you look at the execution plan of your query and suggest some improvements. Re: Improve HAVING BY performance Programming Databases by Reverend Jim >see if you can convert it to a WHERE clause I made a foolish assumption that the HAVING was something that depended on the GROUPing and thus could not be converted to a WHERE. As for my expert, I also assumed that if he could have been more specific he would have been. That would have required more info on your specific situation. May I … Re: help doing a mysql query Programming Web Development by Will Gresham …]. Here is what it says: [quote=php.net] Description: resource msql_query ( string $query [, resource $link_identifier ] ) [/quote] And then goes on to… How to display the data by using dropdown list Programming Web Development by Koh_1 Hi there, May I know if i want to filter 3 column, for example Column A, Column B and Column C When user select Column A, the mysql query will select the data based on the Column A value. When user continue select Column B, the msql query will select the data based on the Column B value from query Column A When user continue select Column C, … MySQL - guidance on multiple WHERE clause Programming Databases by nibbler I'm looking for some guidance on how to develop a msql query that loops through elemenets in a php array. The array is constructed from a multiple line list box.