Home  >  Article  >  Database  >  How to query different databases with one SQL statement

How to query different databases with one SQL statement

php中世界最好的语言
php中世界最好的语言Original
2018-03-23 17:02:143854browse

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';

Example:

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

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!

Statement:
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