简体   繁体   中英

Is there an alias for using * in SQL?

Protecting mySQL queries by algorithms needs knowledge about exploits. Thus I'm checking the query whether it contains *. How to avoid using * in mySQL queries by using alternative syntax? Are there ways to show all database content without using SELECT * FROM

many thanks

The * wildcard means all columns of the table(s) referenced in the query.

The alternative that doesn't use * is to spell out the names of the columns:

SELECT column1, column2, column3, ... FROM ...

In my opinion, an algorithm that counts any SQL query that contains * as an exploit is designed wrong. There are many legitimate uses of that symbol in SQL queries. You might as well count any query that contains an OR boolean operator as an exploit (I have read about so-called security tools that do this, and it's just as misguided).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM