如果使用某些字段名作为默认 mysql 或 mssql 值,例如“ status”,则必须使用反勾(“ select status from table _ name”或“ select id from table _ name where status = 1”)。
因为 mysql 返回错误或者查询无效。
i.e 1.-> use `model`;
here `model` is database name not conflict with reserve keyword 'model'
2- $age = 27;
insert into `tbl_people`(`name`,`age`,`address`) values ('Ashoka','$age',"Delhi");
here i used both quote for all type of requirement. If anything not clear let me know..
SELECT CONCAT(Name, ' in ', city, ', ', statecode) AS `Publisher and Location`,
COUNT(ISBN) AS "# Books",
MAX(LENGTH(title)) AS "Longest Title",
MIN(LENGTH(title)) AS "Shortest Title"
FROM Publisher JOIN Book
ON Publisher.PublisherID = Book.PublisherID WHERE INSTR(name, 'read')>0
GROUP BY `Publisher and Location`
HAVING COUNT(ISBN) > 1;
在上面的语句中,您可以看到 Publisher and Location在 GROUP BY子句中是如何再次使用的。