Home > Database > Mysql Tutorial > body text

How to query different databases with one SQL statement

php中世界最好的语言
Release: 2018-03-23 17:02:14
Original
3853 people have browsed it

This time I will show you how to use a SQL statement to query different databases and one SQL statement to query different databases What are the precautions ? The following is a practical case, one Get up and take a look.

Requirements: A SQL statement queries related results from multiple databases and outputs them to the client

Investigation: springFrameworkcan configure multiple data sources; sql can also Multiple databases can be attached to one main database

Solution: Use the ATTACH DATABASE statement to add multiple libraries to the main library to achieve the function

Syntax:

ATTACH DATABASE 'DatabaseName' As 'Alias-Name';
Copy after login

Example:

ATTACH DATABASE 'C:\Users\Administrator\Desktop\sqlite_data.sq3' As 'sd';
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website !

Recommended reading:

Creating image carousels with Vue

##How to operate tables in Bootstrap

JS gets the value in the first element in the select drop-down box

The above is the detailed content of How to query different databases with one SQL statement. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!