Summary of questions during the MySQL interview

Source: Internet
Author: User
Tags how to prevent sql injection
1. there are two columns A and B in the query question table during the interview. use SQL statements and practice. When Column A is greater than column Blie, select column A. Otherwise, select Column B selectid1 and id2 (casewhenid1id2thenid1elseid2end) asresultfromt4; similar problem: in Table t4, if id2 is greater than 3, the record is qualified, and if it is greater than 5, the record is excellent. Otherwise, the record is unqualified.

1. there are two columns A and B in the query question table during the interview. use SQL statements and practice. When Column A is greater than column Blie, select column A. Otherwise, select Column B, select id1, id2, (case when id1id2 then id1 else id2 end) as result from t4; similar problem, in table t4, if id2 is greater than 3, the record is qualified, and if it is greater than 5, the record is excellent. Otherwise, the select statement is unqualified.

1. query questions during the interview
The table contains columns A and B. use SQL statements and practice. When Column A is greater than column Blie, select column A. Otherwise, select Column B.

select id1,id2,(case when id1>id2 then id1 else id2 end) as result from t4;


Similar problems: In table t4, if id2 is greater than 3, the record is qualified, and if id2 is greater than 5, the record is excellent. Otherwise, the record is unqualified.

Select id1, id2, (case when id2> 5 then 'excellent 'when id2> 3 then' qualified 'else' unqualified 'end) as result from t4;


2. Please retrieve all records whose date (created_ts) is of the current day In the table tb table (the created_ts field is of the datetime type, including the date and time)
Select * from where datediff (dd, created_ts, getDate () = 0
3. SQL mode in Mysql
It is mainly used to restrict whether illegal data is in the data entry stage and to perform compatibility processing.
Run select @ SQL _mode.
4. Differences between char and varchar
5. Data Replication steps
6. Four transaction isolation levels
7. triggers and stored procedures
8. Index type, clustered index, index and lock
9. combined index
10. Describe isnull, ifnull, nullIf
11. Mysql lock Scheduling
12. deadlock and Solutions
13. What are the differences between MyISAM and InnoDB, and common Mysql storage engines?
14. Set up master-slave Replication
15. What are common Mysql logs?
16. Mysql optimization steps
17. How to Prevent SQL Injection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.