Working With Databases and Mysql
Working With Databases and Mysql
LOAD command lets you load the data from a file unto
your table
Syntax:
LOAD DATA INFILE “<file>” INTO TABLE
<table>;
mysql> LOAD DATA INFILE “student_file.txt”
-> INTO TABLE tblstudent;
3
Example
2020
4
SELECT Statement
2020
5
In Writing MySQL Statement
2020
6
Limiting the Rows that are 2020
Selected
• Restrict the rows that are returned by using the
WHERE clause:
7
Using the WHERE clause
2020
8
MySQL Operators
2020
• Arithmetic Operators
Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus
9
Example
2020
10
Defining ‘Alias’
2020
• A column alias:
• renames a column heading
• is useful with calculations
• immediately follows the column name ( there can be an
optional AS keyword between the column name and alias.
• requires double qoutation marks if it contains spaces or
special characters or if it is case-sensitive.
11
Example
2020
12
Logical Operators
2020
• AND or &&
mysql> SELECT * FROM tblStudent WHERE id=10001
AND name=‘Juan Dela Peña’;
mysql> SELECT * FROM tblStudent WHERE id=10001
&& name=‘Juan Dela Peña’;
13
Logical Operators
2020
• OR or ||
mysql> SELECT * FROM tblStudent WHERE id=10001
OR name=‘Juan Dela Peña’;
mysql> SELECT * FROM tblStudent WHERE id=10001
|| name=‘Juan Dela Peña’;
14
Comparison Operators
2020
16
Using the LIKE Condition
2020
18
Example
2020
19
2020
Questions??