Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Understanding databases and tables in SQLite

From: SQLite 3 with PHP Essential Training

Video: Understanding databases and tables in SQLite

SQLite is different than other database management systems in two significant ways. First, SQLite is a database management system in a driver, and two, SQLite stores an entire database in one file. So SQLite itself, the code base that comprises the database management system, lives inside your application as a driver. So when it needs to access its database, which is contained in a file, SQLite must first go through the application, and then the application accesses the file.

Understanding databases and tables in SQLite

SQLite is different than other database management systems in two significant ways. First, SQLite is a database management system in a driver, and two, SQLite stores an entire database in one file. So SQLite itself, the code base that comprises the database management system, lives inside your application as a driver. So when it needs to access its database, which is contained in a file, SQLite must first go through the application, and then the application accesses the file.

What this means is the directory where you're creating your files, and the files themselves, must be accessible by the application. So the application, whatever user it's running under, has to have access to that file, read and write access to the file, and read and write access to the directory the file is contained in, because SQLite creates and destroys a few temporary files along way, as it's managing your database. This becomes a little bit more complicated when your application is a web application.

What this means is that the application itself lives inside the web server. So when SQLite needs to access the file, it must first go through the application, and then the application must go through the web server, and then the web server accesses the file. So this means that the database file itself, and the directory of the database file it's living in must have permissions that will allow read and write access to the web server. So, especially if your web server is a shared UNIX web server, or it's running on a Mac, the web server itself is probably running as a user different than your login user.

This means that your directory and your files must have read/write access to everyone. Keep in mind also that SQLite stores all of the data for a given database in one file. This means that all of your tables are stored in this one file. This can be very convenient for small and medium-sized applications, but it also is significant when you're planning the permissions for your files, and we'll talk more about this as we go on. So, as you create your databases and tables, be aware of how SQLite creates and accesses database files.

Maintain permissions so that the SQLite driver, and its host application, and even the web server has access to the directories and files that it needs. This will keep your development and maintenance cycles smooth and stress free.

Show transcript

This video is part of

Image for SQLite 3 with PHP Essential Training
SQLite 3 with PHP Essential Training

98 video lessons · 7956 viewers

Bill Weinman
Author

 
Expand all | Collapse all
  1. 5m 44s
    1. Welcome
      1m 26s
    2. What is SQLite and what are the prerequisites?
      1m 49s
    3. Using the exercise files
      2m 29s
  2. 41m 36s
    1. Getting the most out of the quick start
      4m 8s
    2. Creating and using a database
      10m 33s
    3. Inserting data into a table
      8m 17s
    4. Getting data from a table
      4m 38s
    5. Updating data in a table
      4m 31s
    6. Deleting data from a table
      4m 12s
    7. Creating a database library
      5m 17s
  3. 39m 19s
    1. Installing XAMPP on a Mac
      5m 59s
    2. Installing XAMPP on a PC
      4m 45s
    3. Setting up SID and exercise files on a Mac
      9m 10s
    4. Setting up SID and exercise files on a PC
      8m 12s
    5. Using the command-line tools
      11m 13s
  4. 30m 44s
    1. Understanding databases and tables in SQLite
      2m 34s
    2. Creating a database
      5m 45s
    3. Setting permissions for a database
      5m 24s
    4. Defining a table in SQL
      2m 21s
    5. Creating a table in PHP
      3m 34s
    6. Creating indexes
      4m 38s
    7. Indexing ID fields
      6m 28s
  5. 36m 35s
    1. Taking care with data types in SQLite
      9m 33s
    2. Storing numbers with INTEGER
      5m 17s
    3. Storing numbers with REAL
      2m 15s
    4. Storing text
      3m 15s
    5. Storing large data with BLOB
      9m 31s
    6. Storing booleans
      2m 24s
    7. Storing dates and times
      4m 20s
  6. 22m 47s
    1. Storing data with INSERT
      4m 1s
    2. Updating data with UPDATE
      3m 12s
    3. Reading data with SELECT
      6m 14s
    4. Reading data from multiple tables with JOIN
      5m 29s
    5. Deleting data with DELETE
      3m 51s
  7. 24m 45s
    1. Understanding expressions in SQLite
      2m 31s
    2. Comparing values with comparison operators
      4m 36s
    3. Matching patterns with LIKE
      4m 28s
    4. Building simple math with arithmetic operators
      3m 13s
    5. Matching values in a list with IN
      2m 22s
    6. Choosing from multiple conditions with the CASE expression
      4m 45s
    7. Forcing a data type with CAST
      2m 50s
  8. 24m 38s
    1. Finding the LENGTH of a string
      1m 52s
    2. Changing case with UPPER and LOWER
      2m 15s
    3. Reading parts of a string with SUBSTR
      2m 34s
    4. Changing parts of a string with REPLACE
      1m 17s
    5. Trimming blank spaces with TRIM
      1m 59s
    6. Reading absolute values with ABS
      1m 6s
    7. Rounding values with ROUND
      1m 42s
    8. Finding the data type of an expression with TYPEOF
      1m 14s
    9. Finding the last inserted record with LAST_INSERT_ROWID
      1m 7s
    10. Getting the version of your SQLite library
      1m 16s
    11. Creating user-defined functions
      4m 51s
    12. Building aggregate user-defined functions
      3m 25s
  9. 18m 58s
    1. Understanding aggregate functions
      2m 15s
    2. Counting rows with COUNT
      3m 30s
    3. Building with the SUM and TOTAL functions
      2m 9s
    4. Finding minimum and maximum values with MIN and MAX
      4m 33s
    5. Finding averages with AVG
      1m 50s
    6. Grouping results with GROUP BY
      2m 23s
    7. Selecting for aggregation with HAVING
      2m 18s
  10. 13m 54s
    1. Understanding SQLite support for dates and times
      4m 31s
    2. Getting readable, sortable dates and times
      3m 36s
    3. Getting high-resolution dates and times with JULIANDAY
      2m 49s
    4. Formatting dates and times with STRFTIME
      2m 58s
  11. 18m 7s
    1. Understanding collation
      1m 0s
    2. Sorting results with ORDER BY
      1m 30s
    3. Removing duplicate results with DISTINCT
      2m 5s
    4. Understanding indexes
      3m 18s
    5. Working with primary key indexes
      4m 12s
    6. Understanding how to use the INTEGER PRIMARY KEY function
      6m 2s
  12. 7m 52s
    1. Understanding transactions
      1m 10s
    2. Using transactions in SQLite
      6m 42s
  13. 16m 6s
    1. Understanding subselects
      1m 29s
    2. Creating a simple subselect
      3m 18s
    3. Searching within a result set
      2m 35s
    4. Searching within a joined result
      3m 59s
    5. Creating a view
      2m 17s
    6. Searching within a joined view
      2m 28s
  14. 15m 56s
    1. Understanding triggers in SQLite
      52s
    2. Automatically updating a table with a trigger
      5m 18s
    3. Logging transactions with triggers
      2m 41s
    4. Improving performance with triggers
      2m 3s
    5. Preventing unintended updates with triggers
      2m 50s
    6. Adding automatic time stamps
      2m 12s
  15. 16m 25s
    1. Choosing an interface
      1m 21s
    2. Using the SQLite3 interface
      2m 41s
    3. Using the PDO interface
      3m 0s
    4. Creating a library
      9m 23s
  16. 16m 33s
    1. Defining CRUD
      4m 5s
    2. Using PHP to open and use an SQLite database
      3m 36s
    3. Using PHP to insert into an SQLite database
      4m 18s
    4. Using PHP to read from an SQLite database
      2m 20s
    5. Using PHP to update an SQLite database
      1m 2s
    6. Using PHP to delete from an SQLite database
      1m 12s
  17. 11m 32s
    1. An overview of the testimonials application
      4m 48s
    2. Managing the database in PHP
      4m 5s
    3. Displaying the testimonials using PHP
      2m 39s
  18. 32s
    1. Goodbye
      32s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed SQLite 3 with PHP Essential Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.