、ICT SQL.pdf
Document Details
Uploaded by UndisputedPiccoloTrumpet
2013
Tags
Full Transcript
Pui Kiu College G7 ICT 2012-2013 – Programming with Kodu CHAPTER 3 INTRODUCTION TO SQL Name: ______________________ Class: ______________________ Class No.: ______________________ Pui Kiu College | Infor...
Pui Kiu College G7 ICT 2012-2013 – Programming with Kodu CHAPTER 3 INTRODUCTION TO SQL Name: ______________________ Class: ______________________ Class No.: ______________________ Pui Kiu College | Information and Communication Technology | Chapter 5: Programming with Kodu 0 Introduction to SQL CONTENTS WHAT IS SQL? 2 HOW TO WRITE SQL COMMANDS IN MICROSOFT ACCESS 2010? 2 SQL BASIC SYNTAX 3 RETRIEVE ALL INFORMATION FROM A DATABASE TABLE 3 RETRIEVE SPECIFIED COLUMNS FROM A DATABASE TABLE 3 ORDERING THE RESULT 3 QUERIES WITH DISTINCTION 5 QUERY WITH SPECIFIC RECORDS (RELATIONAL OPERATORS) 5 EQUAL OPERATOR (=) 6 GREATER THAN (>) OPERATOR 6 LESS THAN (=) OPERATOR 7 LESS THAN OR EQUAL TO ( greater than < less than >= greater than or equal to 2023-2024 Term 1 Grade 9 ICT Page 5 Introduction to SQL ) OPERATOR Example 4: Display those staff members who have been working in the company for more than 10 years. Their names and departments will be displayed on the result. Save query as “Morethan10years”. SELECT Sur_name, Eng_name, Department FROM Employee WHERE Year_Of_Service > 10; 2023-2024 Term 1 Grade 9 ICT Page 6 Introduction to SQL LESS THAN (=) OPERATOR Example 6: Display those staff members with salaries at least 61000 and arrange records in descending order of salary. Save query as “Salary_atleast_61000”. SELECT * FROM Employee WHERE Salary >= 61000 ORDER BY Salary DESC; LESS THAN OR EQUAL TO (= 15000 AND Salary