3.2.3
SQL
Structured Query Language
Structured Query Language
A database is a structured collection of data. Structured query language (SQL) is a language used to query this data.
![Illustrative background for SQL](https://image-v2.cdn.app.senecalearning.com/2018-08/9ff1caf2-7e40-4181-b360-92532f611efc/database-SQL-,h_400,q_80,w_640.jpg)
![Illustrative background for SQL ?? "content](https://image-v2.cdn.app.senecalearning.com/2018-08/9ff1caf2-7e40-4181-b360-92532f611efc/database-SQL-,h_400,q_80,w_640.jpg)
SQL
SQL
- SQL is a language that can tell databases what to do.
- SQL can be used for selecting, inserting, updating, and deleting data.
![Illustrative background for Select statements](https://image-v2.cdn.app.senecalearning.com/2018-08/b6953a42-d91e-4e56-b26c-964521759eb2/speech-bubble-,h_400,q_80,w_640.png)
![Illustrative background for Select statements ?? "content](https://image-v2.cdn.app.senecalearning.com/2018-08/b6953a42-d91e-4e56-b26c-964521759eb2/speech-bubble-,h_400,q_80,w_640.png)
Select statements
Select statements
- A SELECT statement searches for and returns data. E.g:
- SELECT * FROM table_name;
- The * character tells the database to return all fields.
- The * character can be replaced by specific fields. E.g:
- SELECT name FROM users;
![Illustrative background for Where clause](https://image-v2.cdn.app.senecalearning.com/2018-07/95d17dd9-261f-4238-9065-f411ea8c7210/code-Data-Computer-Wifi-Internet,h_400,q_80,w_640.jpg)
![Illustrative background for Where clause ?? "content](https://image-v2.cdn.app.senecalearning.com/2018-07/95d17dd9-261f-4238-9065-f411ea8c7210/code-Data-Computer-Wifi-Internet,h_400,q_80,w_640.jpg)
Where clause
Where clause
- Sometimes we don't want to return data for all records.
- We can filter the data using a where clause as follows:
- SELECT * FROM users WHERE ID=3;
- The above line would only return a user's data where they have an ID of 3.
![Illustrative background for Wildcards](https://image-v2.cdn.app.senecalearning.com/2018-08/d99fc544-4975-4e2d-952c-7e2a470332f3/card-playing-,h_400,q_80,w_640.jpg)
![Illustrative background for Wildcards ?? "content](https://image-v2.cdn.app.senecalearning.com/2018-08/d99fc544-4975-4e2d-952c-7e2a470332f3/card-playing-,h_400,q_80,w_640.jpg)
Wildcards
Wildcards
- Sometimes we don't know the exact value we want to use in a where clause.
- We can use wildcards to find records which match some sort of pattern.
- The % symbol can be used to represent anything.
- For example, if we want to find any names starting with 'Ba' then we could query:
- SELECT name FROM users WHERE name LIKE "Ba%";
1Components of a Computer
1.1Structure & Function of the Processor
1.2Types of Processors
2Software & Software Development
2.1Systems Software
2.2Applications Generation
2.3Software Development
3Exchanging Data
3.1Compression, Encryption & Hashing
3.3Networks
4Data Types, Data Structures & Algorithms
4.1Data Types
5Legal, Moral, Cultural & Ethical Issues
5.1Computing Related Legislation
6Elements of Computational Thinking
6.1Thinking Abstractly
6.2Thinking Procedurally
6.3Thinking Logically
7Problem Solving & Programming
7.1Programming Techniques
7.2Programming Construction
Jump to other topics
1Components of a Computer
1.1Structure & Function of the Processor
1.2Types of Processors
2Software & Software Development
2.1Systems Software
2.2Applications Generation
2.3Software Development
3Exchanging Data
3.1Compression, Encryption & Hashing
3.3Networks
4Data Types, Data Structures & Algorithms
4.1Data Types
5Legal, Moral, Cultural & Ethical Issues
5.1Computing Related Legislation
6Elements of Computational Thinking
6.1Thinking Abstractly
6.2Thinking Procedurally
6.3Thinking Logically
7Problem Solving & Programming
7.1Programming Techniques
7.2Programming Construction
![Go student ad image](/en-GB/revision-notes/_next/image?url=%2Fen-GB%2Frevision-notes%2Fimages%2Fgo-student-uk-ad.jpg&w=640&q=100)
Unlock your full potential with GoStudent tutoring
Affordable 1:1 tutoring from the comfort of your home
Tutors are matched to your specific learning needs
30+ school subjects covered