Enhancing Database Skills: Understanding Built-in Functions and Queries in MySQL
370 likes | 496 Vues
This course provides an in-depth exploration of essential database concepts and tools, focusing on creating and managing databases using MySQL. Participants will learn about database architecture, data flow diagrams (DFDs), entity-relationship diagrams (ERDs), query formulation using relational algebra, and schema implementation. Key topics include built-in functions (mathematical, string, date, and system), data extraction, normalization, and performance improvement techniques. By the end of the course, learners will confidently work with joins and advanced database functionalities.
Enhancing Database Skills: Understanding Built-in Functions and Queries in MySQL
E N D
Presentation Transcript
M Taimoor Khan taimoorkhan@ciit-attock.edu.pk builtin functions
Course Objectives • Basic Concepts • Tools • Database architecture and design • Flow of data (DFDs) • Mappings (ERDs) • Formulating queries (Relational algebra) • Implementing Schema • Built-in Functions • Extracting data • Working with Joins • Normalization • Improving performance • Advanced topics
Built-in Functions • Mathematical • String • Date • System • Aggregate
Built-in Functions • System • Math • Date
Categories of Functions • Depending on the arguments and the return value, categorized • Mathematical (ABS, ROUND, SIN, SQRT) • String (LOWER, UPPER, SUBSTRING, LEN) • Date (DATEDIFF, DATEPART, GETDATE()) • System (USER, DATALENGTH, HOST_NAME) • Conversion (CAST, CONVERT)
Counting Rows • Databases are often used to answer the question, "How often does a certain type of data occur in a table?" • For example, you might want to know how many pets you have, or how many pets each owner has. • Counting the total number of animals you have is the same question as “How many rows are in the pet table?” because there is one record per pet. • The COUNT() function counts the number of non-NULL results.
Counting Rows Example • A query to determine total number of pets: mysql> SELECT COUNT(*) FROM pet; +----------+ | COUNT(*) | +----------+ | 9 | +----------+
Built-in Functions • Mathematical • String • Date • System • Aggregation
Next Lecture • MySQL JOINS