SQLite3 fuzzy query

Source: Internet
Author: User
If you have not installed or used sqlite, you can use SQLite3 for installation and basic operations. 1. Create a database test. dbcd ~ Sqlite3test. db

If you have not installed or used sqlite, you can use SQLite3 for installation and basic operations. 1. Create a database test. db cd ~ /Sqlite3 test. db

If you have not installed or used sqlite, you can use SQLite3 for installation and basic operations.

1. Create a database test. db

Cd ~ /

Sqlite3 test. db

In this way ~ /A database file test. db is generated under the directory.

2. Create a table song

Create table if not exists song (path TEXT, title varchar (20 ));

Create a database table named song, which contains the path and title fields in the Text and varchar types.

3. insert data

Insert into song values ('/mnt/sdcard/Music', 'Only You ');

Insert into song values ('/mnt/sdcard/Music', 'love ');

Insert into song values ('/exte/Music', 'thineking ');

A total of three data records are inserted.

Verify the data in the database table. Query:

Select * from song;

4. query the data of a specified condition

Select * from song where path = '/mnt/sdcard/music'

Or

Select * from song where path = "/mnt/sdcard/music"

Now I have a requirement to find the song information under all/directories?

Fuzzy query!

Select * from song where path LIKE '/% ';

Or

Select * from song where path LIKE "/% ";

Easy to handle!

,

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.