This guide will introduce MySQL, a powerful and popular free relational database system.

Size: px
Start display at page:

Download "This guide will introduce MySQL, a powerful and popular free relational database system."

Transcription

1 This guide will introduce MySQL, a powerful and popular free relational database system.

2 Introduction... 2 Planning your database structure... 3 An introduction to Workbench... 5 Connecting to your database... 5 Creating tables Adding data to the new table An introduction to SQL SQL syntax SELECT The WHERE Clause Using multiple conditions INSERT UPDATE Ordering and grouping your results Grouping your results Ordering your results MySQL built in functions Table relationships Joining tables INNER JOIN LEFT JOIN RIGHT JOIN Product categories: A many-to-many relationship Creating the many-to-many JOIN Appendix A: Data type reference Appendix B: Example data Fasthosts MasterClass Range Page 1

3 When you search the internet, check your bank balance online, or do your internet shopping, you are using a database. In fact, most websites connect in some way to a database. A database is simply a series of tables which contain information, or data. They can be small, or they can contain millions of records. The purpose of a database is to make it quick and easy to create dynamic websites. Let s take, for example, an ecommerce website that sells CD s. Without a database the developer of the website would need to create a separate page on the site for every CD. For a large shop this could be thousands upon thousands of individual pages A database allows that developer to create one page, which can then connect to the database, retrieve the relevant information for any of the CD s, and then display it. Furthermore, the developer could add the ability for a website administrator to login to a separate portal, and add or update products without any development knowledge. There are many different databases out there, and most are very similar. We are going to concentrate on one in particular, MySQL. MySQL is a popular and open source relational database application. It is known as a relational database because the data held within can be structured in such a way that relationships can be created between its tables. This makes organising the data much easier and more convenient. You can add, retrieve, and modify the data held within a database using a programming language called SQL, which is an acronym for Structured Query Language. Page 2

4 A well designed database will simplify your website development, deployment, and maintenance and improve its performance. Before creating a database, it is important to sit down and plan out how the data will be structured, and how different tables will interact. Failure to properly plan your database may result in problems later in development, such as slow data retrieval leading to slow website performance, or redundant data. When planning your database you should: Identify the purpose of the database. List the tables and columns Identify the relationships Although this sounds obvious, this stage often gets overlooked. Before you start to plan the structure of your database, you need to plan what functionality is required of it. If the purpose of your database is to drive a website, you need to sit down and plan exactly how the website will work, how the user will interact with the website, and what information the site needs to work with. For example, if you are using your website to sell your products you need to decide what information visitors should have access to for each product, how you will organise the products (for example within categories), what search options should be made available, and so on. Will your site use a shopping basket? Will your customers need to sign up for an account? Can customers sign up for a newsletter? Now that you have decided exactly what your database needs to achieve, you should list the data that you will need to store. Start by listing all objects on which you will store information, such as products, categories, users, user profiles, blog posts and so on. Following this start listing the information you will store for each object, such as the products name, price, date added, number of stock etc. Don t forget to give each table at least one unique identifier, such as an ID field. Once you know what data you need to store, start naming your columns and tables. Make sure you create a standard naming convention to avoid confusion. It is important to make sure you are not unnecessarily duplicating information. One of the main strengths of a relational database is the ability to create relationships between tables. If there is a good chance that the same data may appear in multiple records, consider moving it into another table. Page 3

5 Finally you should define how the data within the different tables will interact. For example, in a database intended for an ecommerce site, you might have a table for products, and another for categories. You need to define the relationship between these two tables: will one product only be allowed to belong to one category, or can one product appear in multiple categories? Can each category have subcategories? Page 4

6 MySQL Workbench is the official software for administering and querying the data within a MySQL database. It is available for free from the MySQL website. At the time of writing the current version of MySQL Workbench is 5.2. Before you can start adding data to your database you need to set up a connection within MySQL Workbench. Workbench will save the connection, so you will only need to enter the connection details of your database once. In order to connect to your MySQL database you will need the following details: Database host: This is the address of the server that hosts your database. This will probably be an IP address (for example ). Database name: The name of the database. Username: The name of the database administrator or owner. If your database is hosted with Fasthosts this is the database owner, and you chose the username when you created the database. Password: The password for the above user. Quick tip: If your database is hosted with Fasthosts and you are unsure of your database password, you can reset it within your Fasthosts control panel. Open MySQL Workbench. Click New Connection in the left-hand column of the screen. Page 5

7 The Setup New Connection window will open. Enter a name in the Connection Name text field. It doesn t matter what you type in here, this is just to help you identify your database. Page 6

8 In the Hostname text field enter the address of your database server. This is probably an IP address. Leave the Port text field set to In the Username text field enter the username you will use to connect to your database. MySQL Workbench can store the database password, so you don t have to type it in each time. This is not recommended if you share the computer with other users. If you would like MySQL Workbench to remember your database password click the Store in Vault button, enter your database password when prompted, and click OK. Page 7

9 In the Default Schema text field, enter the name of your database. Click the Test Connection button. MySQL Workbench will attempt to connect to your database. Assuming the connection was successful you will see a message similar to the following. If MySQL Workbench is unable to connect, check the database settings you have entered are correct. Click OK to store the new connection. It will now appear in the left-hand column. Page 8

10 To connect to the database, simply double-click the new item in the list. If you did not store the database password when you set up the connection, you will be prompted to enter it now. Page 9

11 Now that we have connected to your database, let s add some data. Before we add the data we need to create a table to store it within. As we are setting up a database for an ecommerce garden supplies store, our first table will store our products. It will store the following columns. Column Data type Description ID Integer (nondecimal number) Name String of 25 characters Description String of 100 characters The unique table key. This number is set by MySQL and is incremented automatically each time a new record is added. The name of the product, up to a maximum of 25 characters in length. A description of the product to help customers see what they are buying, up to a maximum of 100 characters in length. Price Decimal number The price of the product. This data type is a number with two decimal places and a maximum of 5 digits (for example ). Available Integer The number of products in stock. Type Integer Links to a record in another table which we will create later. This will store the type of plant, for example perennial, annual, or biennial. Open MySQL Workbench if it is not already open, and double click on the connection for your database in the left hand column. Page 10

12 Click the Create new table button on the toolbar. Note: If the message No Schema Selected appears when you click on the Create new table button, right-click on your database name in the Object Browser on the left of the window and select Set as Default Schema. In the Table Name text field, enter a name for your table. We will call our table Products. Page 11

13 Quick tip: The Comments text field allows you to record the table s purpose, and add any notes you might need to refer back to later. This is entirely optional and can hold up to 60 characters. Let s create our first column, which will hold the ID field. In the Columns list, click the first empty entry just underneath the Column Name heading. This should allow you to enter the name of your column, so enter ID and press the Enter key. The next column is the Datatype. This is where we choose what type of data we are using. You should consider the data type carefully, and always select the best data type for the information the column will hold. Page 12

14 Some commonly used data types are INT (integer, a whole number), VARCHAR (variable character, a string of up to 255 characters), BLOB or TEXT (larger strings), DATE (date only), and DATETIME (date and time). Our ID field will be an integer, so select INT from the drop down list that appears in the Datatype column. Next to the Datatype column is a series of columns with tick boxes in them. These columns are: Column Name Description PK Primary Key Each table needs a primary key, which is used to identify each record. The value of the primary key must be unique. NN Not Null If selected, each record must have a value for this column. If not selected the value of this column can be NULL (no value). UQ Unique index If selected the value of this column cannot be identical to the value in another record. This is similar to the primary key, but a unique index can be NULL (no value) whereas a primary key must always have a value. BIN Binary If selected any queries will compare the value of fields in this column in a byte by byte manner, rather than character by character. As a result this column will be case-sensitive. UN Unsigned If the data type is numerical, a signed column can include a positive or negative +/- sign. As a result a signed column value can be positive or negative, whereas unsigned columns can only be positive. The maximum allowed value of an unsigned column is much higher than that of a signed field. The maximum values for signed and unsigned values are detailed in Appendix A: Data type reference on page 60. ZF Zero fill In a numerical column, the zero fill will cause values to be Page 13

15 padded with leading zeros. You can specify how many numbers the column needs when specifying the Datatype. For example, if the data type is set to INT(10) and Zero fill is selected, any number entered will automatically be padded to 10 characters, so 25 would become AI Auto incremental If the data type is numerical, the value of the field will automatically increment by 1 each time a new record is added. The ID field is the primary key for our table; we will use the ID field to identify each individual product. The value of ID cannot be NULL and each ID value must be different, so we want the value to auto-increment by one each time a new product record is created. Tick the PK (Primary Key), NN (Not Null), and AI (Auto Increment) columns. Because the value of the ID field should not be a negative number, you also need to ticket the UN (Unassigned) box. Next let s create a column to store the name of each product. Underneath our ID, click the Column Name column and type Name as the next column name, then press Enter. Page 14

16 We are creating this column as a variable character, and we will tell MySQL to reserve 25 character spaces for the value of this column. In the Datatype column, enter VARCHAR(25). All our products must have a name, so we don t want it to be possible to set a NULL value for this column. Tick the NN (Not Null) box. Add the remaining three columns: Column name Datatype Flags Description VARCHAR(100) NN (Not Null) Price DECIMAL(5,2) NN (Not Null) Available INT NN (Not Null), UN (Unsigned) Type INT UN (Unsigned) Page 15

17 We are adding a Description column with a maximum character length of 100 characters. If you decide this is not enough you can change it to any number up to and including 255. If you will be adding more text than this, feel free to change the data type to TEXT or BLOB. We are also adding a Price column as a decimal number. We have set the data type to DECIMAL(5,2) which tells MySQL that the number can be up to 5 characters long, and has 2 decimal places. This will allow any value up to and including If your shop is likely to sell products above this price, you can select a suitable length. For example, if you are likely to sell products up to a value of use DECIMAL(6,2). If you need to change it at a later date to accommodate a new product, you can. And our Available column will store the number of items in stock for each product. As it s not possible to have less than zero products in stock, we ve selected the unsigned flag. Your columns should look similar to this: Click the Apply button. Page 16

18 MySQL Workbench will compile the required SQL statement to create the table, but before it executes the query it will ask you to confirm that you are happy to proceed. Click Apply to create the table. Page 17

19 Click Finish once the query has finished running. Congratulations, you ve created your new table. Now that we have created the table, let s add some products to it. In the Object Browser on the left hand side of the MySQL Workbench window, right click on your newly created Products table in the tree, and select Edit Table Data from the menu that pops up. Page 18

20 This will open a tab for your table within the main workspace area of MySQL Workbench, allowing you to enter data into each column in the table. We will enter the following details for the first item: Column Data ID (Leave this blank, MySQL will automatically assign the ID.) Name Fuchsia Plant Description Hardy perennial, 2 jumbo plugs Price 7.99 Available 4 Type Leave this blank, we will enter this later. Enter the necessary data into each column. Because we set our ID column as an autoincremental primary key we don t need to enter anything here. MySQL will set this value for us. It is very important to note that the changes will not be committed until you click Apply. Page 19

21 Add a few more records and click Apply. A full list of the data we are using in our examples is available in Appendix B: Example data on page 62. Now that we have added some sample records, we can start learning about using SQL to retrieve and modify the data held within your database. Page 20

22 SQL is an acronym for Structured Query Language. It is a powerful programming language specifically designed for querying and managing the data held within a relational database. It is worth noting that, although SQL itself is a standard of the International Organization for Standards (ISO), there may be subtle differences between different database platforms. Using a number of SQL statements you can request data, create or delete tables, add, update, or delete records in a table, and much more. There are over 50 different statements for MySQL, many of which you will probably never need to use. In this guide we will cover the following statements, which are mainly used for requesting and modifying the data in one or more tables. Statement SELECT INSERT UPDATE DELETE GRANT Description Probably the statement you will use the most. The SELECT statement requests a list of records from one or more tables in your database. The INSERT statement adds a new record to a table in the database. The UPDATE statement modifies the data in an existing record. The DELETE statement deletes one or more records from a table. The GRANT statement is not one you ll use often, but is important. It grants access permissions to a user in your database. One of the advantages of SQL is that the language has been designed to be easy to read, much easier than most other scripting languages such as PHP or ASP.NET. The language itself is not a case sensitive language, which means you can write your code in uppercase, lowercase, or a combination of the two. However, it is generally good practice to use uppercase for any SQL keywords. This makes your code easier to read, and helps you distinguish between SQL keywords and your table names. Table and column names are case sensitive. So, for example, if you try to refer to a table called Products as products, PRoducts, or PRODUCTS, MySQL will return an error to inform you that it could not find your table. One other thing to remember when writing SQL is that each line of code should end with a semi-colon (;). Some SQL databases require that the semi-colon be present, although MySQL does not so your SQL queries will work both with and without. However, it is good practice to include the semi-colon and it will make life easier if you ever need to transition to a database that does require it. Page 21

23 The SELECT statement allows you to request a list of records from one or more tables in your database. The syntax for the SELECT statement is as follows: SELECT <columns> FROM <table>; To run your first SQL query, you ll need to open MySQL Workbench. Double-click the name of your database in the Open Connection to Start Querying list. This will open up the SQL Editor. On the left of the window is the Object Browser, which lists your database. You can expand your database to list its tables. Page 22

24 In the centre is the Query window. In this window enter the following SQL query, which will tell MySQL to return all columns (the asterisk (*) is a wildcard) from the Products table: SELECT * FROM Products; Page 23

25 Click the Execute button on the toolbar, which looks like a lightning bolt. Quick tip: Instead of using the Execute button each time, you can use the shortcut key CTRL+ENTER when you have finished typing your query. This should return a list of all products in your Products table. Page 24

26 Underneath this, the Output window will display the status of the query - whether it was successful or not, the time it took to execute, and the number of records found (or the error message if there was a problem). While you can use the asterisk (*) to request all columns, it is good practice to request only the columns you need to query. This is especially true if you intend to use a scripting language, such as PHP, to connect to your database. Requesting all fields increases overheads on the database server and may affect the performance of your application, particularly on large tables that contain substantial quantities of data. To request only the ID, Name, and Description fields from the Products table you can use this syntax: SELECT ID, Name, Description FROM Products; As you can see in the returned results, only the three columns are now returned. Page 25

27 Page 26

28 At the moment we have only returned information for all records in a table. The WHERE clause lets us limit the results by only returning records that meet set criteria. The syntax of a SELECT statement with a WHERE clause looks like this: SELECT <columns> FROM <table> WHERE <conditions>; For example, let s return only the first record in the products table. We know the value of its ID field is 1, so our query will look like this: SELECT * FROM Products WHERE ID= 1 ; Because the ID field is unique, this query will only return one record, providing there is a product in your Products table with an ID value of 1. Page 27

29 The = symbol is called a comparison operator, and will return records where the value of the record exactly matches the value given. There are several comparison operators you can use in your queries, the most commonly used of which are listed. Operator Description = Match values that equal the given value!= Match values that do not equal the given value. > Match values that are greater than the given value. >= Match values that are greater than or equal the given value. < Match values that are less than the given value. <= Match values that are less than or equal the given value. BETWEEN AND Match all values that equal or fall between two given values. LIKE Match records that match a given string pattern. The equal operator returns records that exactly match the given value. The following example will return only the record where the value of the ID field is 1. SELECT * FROM Products WHERE ID= 1 ; The not equal operator returns records that do not exactly match the given value. The following example will return all records in the Products table, but only if the value of the Available field is not 0. SELECT * FROM Products WHERE Available!= '0'; The greater than operator will return all records where the value of the given field is greater than the value supplied. The following example will return all records where the ID is greater than (but not including) 5. SELECT * FROM Products WHERE ID > '5'; Page 28

30 This operator is almost identical to the greater than operator. It will return all records where the value of the given field is greater than or the same as the supplied value. The following example will return all records where the ID is equal to 5 or higher. SELECT * FROM Products WHERE ID >= '5'; The less that operator will return all records where the value of a given field is less than, but not including, the supplied value. This example will return all records where the value of the ID field is less than 10. SELECT * FROM Products WHERE ID < '10'; This operator will return all records where the value of the given field is less than or equal to the value supplied. The following example will return all records where the value of the ID field is 10 or less. SELECT * FROM Products WHERE ID <= '10'; The BETWEEN AND operator lets you return all records where the value of a given field falls between two supplied values. The following example will return all records where the value of the ID field is equal to 5, 6, 7, 8, 9, or 10. SELECT * FROM Products WHERE ID BETWEEN '5' AND '10'; The LIKE operator allows you to return records where the value of a given field matches a supplied pattern. Page 29

31 There are two wildcards that you can use in your pattern: Wildcard Description % The percentage symbol allows you to match a string of any number of characters (including no characters). _ The underscore symbol allows you to match a string of a single character. Our first example will match any records where the Description field contains the word perennial anywhere within it. SELECT * FROM Products WHERE Description LIKE '%perennial%'; We use the percentage symbol first to tell MySQL there can be any number of characters before the word perennial. We also use the same wildcard after the text we wish to search for to tell MySQL there can be any number of characters following the word. Now let s say we want to return a list of records in which the Name field begins with the word strawberry. For example we want to return Strawberry Plant, Strawberry Seed, and Strawberry Fertiliser. SELECT * FROM Products WHERE Description LIKE 'strawberry%'; We don t need a percentage wildcard before the word strawberry, but we do need one after it otherwise we won t match the words plant, seed, and fertiliser. The underscore character works in the same way, except it only matches a single character. As an example, let s find all seed packets with 100 or more seeds. SELECT * FROM Products WHERE Description LIKE '%1 packet ( seeds)%'; This example will match any records where the description contains the words 1 packet (nnn seeds) where nnn is a three digit number. You can specify more than one condition with the WHERE clause, using the AND or OR operators. Page 30

32 Use the AND operator when you want all of your conditions to be met. The syntax is: SELECT <columns> FROM <table> WHERE <conditions> AND <condition>; For example, if you want to display all records in your Products table where the value for Available is greater than 0 and the price is or less, you can use this query: SELECT * FROM Products WHERE Available > '0' AND Price <= '14.99'; You can use as many AND statements as you need in your query. Let s add another AND condition to search for products with strawberry in the name. SELECT * FROM Products WHERE Available > '0' AND Price <= '14.99' AND Name LIKE '%strawberry%'; Use the OR operator if you have more than one condition, but any of them can be true. The syntax is: SELECT <columns> FROM <table> WHERE <conditions> OR <condition>; For example, if you want to display all Products that contain either strawberry or tomato in the name, you can use: SELECT * FROM Products WHERE Name LIKE '%strawberry%' OR Name LIKE '%tomato%'; You can combine AND and OR operators in your queries. Page 31

33 For example, let s find all records that contain the words strawberry or tomato in the Name column, and the value in the Available column is greater than 0. SELECT * FROM Products WHERE Name LIKE '%strawberry%' OR Name LIKE '%tomato%' AND Available > '0'; Page 32

34 The INSERT statement allows you to insert a new record into a given table. The syntax for the INSERT statement is as follows: INSERT INTO <table> (<columns>) VALUES (<values>) ; Let s insert a new record into our Products table, with the following values: Column Name Value Name Petunia Plant Description Half-hardy annual, 50 plugs. Price Available 5 Type 2 We don t need to specify a value for the ID field, because we set this column as our primary key. The ID field auto-increments, so MySQL will set this value for us. Our SQL query to add the new product looks like this. INSERT INTO Products (Name, Description, Price, Available, Type) VALUES ('Petunia Plant', 'Half-hardy annual, 50 plugs.', '12.99', '5', '2'); Run this query in MySQL Workbench, and if successful the Output window should tell you that 1 row has been affected by your query. The affected row is your brand new record. Page 33

35 Page 34

36 The UPDATE statement allows you to modify the data help within one or more records in the database. The syntax for the UPDATE statement is: UPDATE <table> SET <edits> WHERE <conditions>; Let s change the price of one of the products. We will use an UPDATE statement to change the value of the Price field for the first product to UPDATE Products SET Price = '7.99' WHERE ID = '1'; The WHERE clause is very important in an UPDATE statement. If we missed the WHERE clause, MySQL would update every record in the database to set the price of each product to 7.99, so be very careful with your UPDATE statements to ensure you re only updating the records you need to. Page 35

37 As with SELECT statements, you can supply multiple WHERE clauses with the AND and OR keywords. This example will UPDATE our first product, and set the availability to 5, but only if the current value for availability is 0. UPDATE Products SET Available = '5' WHERE ID = '1' AND Available = '0'; As you can see, our first product was not updated in this example because it did not meet all the criteria in the WHERE clause. This is because the current availability of our first product is greater than 0. Page 36

38 You can manipulate the results that are returned by a SELECT statement. In certain circumstances you may wish to group records together by the value of a certain field. This can be easily achieved with the GROUP BY statement, which has the following syntax: SELECT <columns> FROM <table> GROUP BY <column>; SELECT <columns> FROM <table> WHERE <conditions> GROUP BY <column>; The GROUP BY statement should always be placed after the WHERE clause, or the FROM statement if your SQL query does not contain a WHERE clause. Let s say for our stocktaking we want a list of the number of products grouped by the number available. We can group by the Available column, so all records with an availability of 0 will be grouped into one result, all records with an availability of 1 will be grouped together into another result, and so on. SELECT * FROM Products GROUP BY Available; If you run this query in MySQL Workbench, you will now see that there is only one record for each value in the Available field. This isn t much use to us at the moment; we need to know how many products have been grouped for each value in the Available column. To do this we use one of MySQL s built in functions, COUNT(), on the column we are grouping by. SELECT COUNT(Available), Available FROM Products GROUP BY Available; Now if you run this query you will see the availability of each product, and the count of the products that have been grouped into that availability. Page 37

39 There is a high chance that you will need to sort the results of your SELECT queries into either alphabetical or numerical order. This is accomplished with the ORDER BY statement: SELECT <columns> FROM <table> ORDER BY <column>; SELECT <columns> FROM <table> WHERE <conditions> ORDER BY <column>; SELECT <columns> FROM <table> WHERE <conditions> GROUP BY <column> ORDER BY <column>; The ORDER BY statement should always appear after the GROUP BY statement. If there is no GROUP BY statement, it should appear after the WHERE clause, and if there is no WHERE clause it should appear after the FROM statement. As an example, let s sort the records in our Products table into alphabetical order by the product s name. SELECT ID, Name, Description FROM Products ORDER BY Name; By default the ORDER BY statement will sort in ascending order. However, you can specify whether to sort in ascending or descending order, using the ASC or DESC keywords. To sort in ascending order (A to Z): SELECT ID, Name, Description FROM Products ORDER BY Name ASC; To sort in descending order (Z to A): SELECT ID, Name, Description FROM Products ORDER BY Name DESC; Page 38

40 You can sort your results by more than one column, by simply listing each column name separated by a comma, after the ORDER BY statement. SELECT <columns> FROM <table> ORDER BY <column1> ASC, <column2> ASC, <column3> DESC etc; Let s say we have a table that contains a list of customers, with the following data: ID FirstName Surname 1 Geoff Simpson 2 George Smith 3 Norman Smith 4 Bob Smith 5 Alan Smith 6 Andrew Simpson If we were to use the ORDER BY statement on the Surname, the results would be as follows. SELECT * FROM Users ORDER BY Surname ASC; ID FirstName Surname 1 Geoff Simpson 6 Andrew Simpson 2 George Smith 3 Norman Smith 4 Bob Smith 5 Alan Smith While these results are sorted by Surname, they are still not sorted correctly as our results don t take the first name into consideration while sorting. Ideally we want to sort primarily by Surname, and then sort by FirstName. SELECT * FROM Users ORDER BY Surname ASC, FirstName ASC; Page 39

41 ID FirstName Surname 6 Andrew Simpson 1 Geoff Simpson 5 Alan Smith 4 Bob Smith 2 George Smith 3 Norman Smith Much better! Now we are sorting the users correctly by surname, and then by first name. Page 40

42 MySQL includes a number of functions to extend the capabilities of the SQL language and allow you to perform calculations or modify your data. Here are just a few of the functions that you will find most useful in your SQL queries. A full list of all available functions is available in the MySQL online documentation. The AVG() function returns the average value of a column when a GROUP BY statement is used. For example, in a table of people where each record contains the persons age, you could find the average age of all people in the table with the following query: SELECT AVG(Age) FROM People; The CHAR_LENGTH() function simply returns the number of characters in a given string or field value. For example, in a table of people, you can display the length of each person s name with the following query. SELECT Surname, CHAR_LENGTH(Surname) FROM People; You could sort people by the length of their name by using the CHAR_LENGTH() function in an ORDER BY statement: SELECT Surname FROM People ORDER BY CHAR_LENGTH(Surname) DESC; The CONCAT() function allows you to join two or more strings or field values together into one column. Each value should be separated with a comma. For example, in a table that contains details of people, where the first name and surname of each person are held in separate columns, we can return the list of all people with the first name and surname combined into one column with the following query: Page 41

43 SELECT CONCAT(FirstName, " ", Surname) FROM People; In our example there are three values passed to CONCAT(). The first is the name of the column containing the surname, the second is a string containing the space that separates the two names, and the third contains the name of the column containing the surname. Using the same table we could also display the name in the format First, Surname using the following query: SELECT CONCAT(Surname, ", ", FirstName) FROM People; The COUNT() function will display the number of records that have been grouped using the GROUP BY statement. For example, in a table of people we could return the number of people with each surname with the following syntax: SELECT Surname, COUNT(ID) FROM People GROUP BY Surname; The LOWER() function simply returns a string or field value in lower case characters. For example, to return the value of a field in lower case characters, use the following syntax: SELECT LOWER(Surname) FROM People; The MAX() function returns the highest value of a column when using the GROUP BY statement. For example, in a table of people in which the age is recorded, you can return the age of the oldest person with the following query: SELECT MAX(Age) FROM People; Page 42

44 The MIN() function returns the lowest value of a column when using the GROUP BY statement. For example, in a table of people in which the age is recorded, you can return the age of the youngest person with the following query: SELECT MIN(Age) FROM People; The MONTH() function returns the month of a given date. For example, in a table containing people with a column for date of birth, you can find the month each person was born with the following query: SELECT FirstName, Surname, MONTH(Born) FROM People; To Display all records for people that were born in March, use the following query: SELECT FirstName, Surname, Born FROM People WHERE MONTH(Born) = '3'; The NOW() function returns the current time on the database server. To view the time you can use the following syntax: SELECT NOW(); As an example of the NOW() function in use in a query, let s say your database contains a table of user accounts with a column that stores a closure date. To view all accounts that have been closed, i.e. the closure date is in the past, you can use the following syntax: SELECT * FROM Users WHERE DATE(Closure) < NOW(); Page 43

45 The ROUND function rounds a number to a specified number of decimal places. If a number of decimal places is not supplied when calling the function, ROUND() rounds the number to a whole number. This example builds on our example for AVG(), and returns the average age of all people in a table, rounded to the nearest whole number: SELECT ROUND(AVG(Age)) FROM People; The example below is the same as the one above, except this time we round to 2 decimal places. SELECT ROUND(AVG(Age), 2) FROM People; The SUM() function returns the total combined value of all values in a column. For example, in a table of people in which the age is recorded, you can return the total combined age of all persons with the following query: SELECT SUM(Age) FROM People; The TIME() function extracts the time part of a DATETIME field s value. As an example of the TIME() function in use in a query, let s say your database contains a table of user accounts with a column that stores a closure date and time. To view all accounts that are set to close in the morning, you can use the following query: SELECT * FROM Users WHERE TIME(Closure) < '12:00:00'; Page 44

46 The UPPER() function simply returns a string or field value in upper case characters. For example, to return the value of a field in upper case characters, use the following syntax: SELECT UPPER(Surname) FROM People; The WEEKDAY() function returns a numerical value representing the day of the week in a given date. The values that can be returned by this function are: Value Representing Value Representing 0 Monday 4 Friday 1 Tuesday 5 Saturday 2 Wednesday 6 Sunday 3 Thursday So, for example, in a table of people in which the date of birth is recorded, you can display all records for people that were born on a Monday (0) with the following query: SELECT FirstName, Surname, Born FROM People WHERE WEEKDAY(Born) = '0'; To run the same query to find all people who were born on a Friday (4), simply change the WHERE clause: SELECT FirstName, Surname, Born FROM People WHERE WEEKDAY(Born) = '4'; The YEAR() function returns the year of a given date. For example, in a table containing people with a column for date of birth, you can find the year each person was born with the following query: SELECT FirstName, Surname, YEAR(Born) FROM People; Page 45

47 To Display all records for people that were born before 1990, use the following query: SELECT FirstName, Surname, Born FROM People WHERE YEAR(Born) < '1990'; Page 46

48 MySQL is a relational database, which means that data that is held in separate tables can be related to each other. There are several different relationships that you can create between tables in a database. A one-to-one relationship is when one record in one table directly references one record in another table. Each record in the first table can only relate to one record in the second and each record in the second table can only link to one record in the first. Let s take, for example, a table that contains employees, and another that contains their addresses. Employees table Column ID Name DOB Started AddressID Description Unique record identifier String for employee s name. Date field for date of birth. Date employee started working at the company. Integer field that points to the ID of the record in the Addresses table. 1 : 1 Addresses table Column Description ID Unique record identifier House House number or name. Street Street name. Town Town or city name. County County. Postcode The postcode. Each employee record has only one address at which they live. The AddressID column in the Employees table will contain the unique ID of the corresponding record in the Addresses table. Page 47

49 A one-to-many relationship allows one record in one table to have a relationship with multiple relationships in another table. Let s say, for example, that we have an online shop that includes a table containing information about our customers. We also have a table for orders, and an order is created each time a customer makes a purchase. Each customer can have multiple orders, but each order can belong to only one customer. Customer table Column ID Name AccNum Description Unique record identifier String for customer s name. Account number The customers address. Orders table Column Description 1 : ID Unique record identifier CustID ID of the customer record to which this order belongs. Date The date and time this order was placed. Total Total spent in this order. Page 48

50 A many-to-many relationship allows multiple records in one table to have multiple relationships to records in another table. As an example we will build upon the example above. Each order that a customer places can hold various products. Each product can also be in multiple orders. Orders table Column ID Date Total Description Unique record identifier The date and time this order was placed. Total amount spent in this order. Products table : Column Description ID Name Price Available Unique record identifier Name of the product. The price of the product. The number of available stock. Many-to-many relationships need a third table, the sole purpose of which is to store the relationships between the different records in the two tables. This extra table is often called a junction table. Orders table Junction table Products table Column ID Date Total 1 : Column ID OrderID ProductID Description Unique record identifier The ID number of the record in the Orders table. The ID number of the record in the Products table. : 1 Column ID Name Price Available As you can see a many to many relationship actually consists of a one-to-many relationship between the first table and the junction table, and another one-to-many relationship between the second table and the junction table. Page 49

51 A self-referencing relationship is used when a table needs to relate to itself. For example, an ecommerce site may have multiple categories and subcategories for its products. Rather than having a separate table for subcategories, it may be beneficial to instead list all subcategories in the same table, with a separate column to refer to the subcategories parent. Categories Table Column ID Name Parent Description Unique record identifier String for categories name. Integer value that points to the ID number of subcategories parent category in the same table. It should be possible to set a NULL value in this column, for top-level categories. 1: This relationship is similar to a one-to-many relationship because each category can have multiple child records. Page 50

52 When querying records from two or more tables that have relationships with each other, we need to pull information from all related tables in the same query. This is achieved using joins, which connect tables based on linking columns. When you created your Products table you created a field called Type. We will now put this field to use. The type column is intended to reference the type of plant, for example perennial, annual, or biennial. We can then link each product to one of these types by setting the Type column for each plant to the ID number of the corresponding record in another table, which we will call Types. Our products don t necessarily have to be plants. For example, our garden centre may also sell supplies, such as tools, garden ornaments, or fertilisers. These products won t link to a record in our Types table, so for each of these records the Type field should be NULL. Open MySQL Workbench, double click on your database connection, and create a new table called Types with the following columns. If you need guidance during the process you can refer back to Creating tables on page 10. Column name Datatype Flags ID INT PK (Primary Key), NN (Not Null), UN (Unsigned), AI (Auto-Increment) Name VARCHAR(45) NN (Not Null) Description VARCHAR(100) NN (Not Null) Now add some data to the table. The categories we have created are shown in Appendix B: Example data on page 62. Let s add some sample data to the Types table. Open the table and add the following data. Refer to Adding data to the new table on page 18 if you need to. ID Name Description 1 Perennial A perennial plant lives for three or more seasons. 2 Annual An annual plant blooms, seeds, and dies within one growing season. 3 Biennial A biennial plant grows over two seasons before it dies. Page 51

53 Now we need to set a type for each of our plants. To do this we need to set the Type field in the Products table to the ID of the necessary record in the Types table. For example, our first product is a Fuchsia plant, which is a perennial plant. In the Types table the Perennial record has the ID value of 1. We therefore need to set the value of the Type column in the Products table for the Fuchsia to 1. ID Name Description Price Available Type 1 Fuchsia Plant 'Hardy perennial, 2 jumbo plugs Set an appropriate type for each product. For any products that do not require a type, i.e. products that are not plants, simply leave Type as NULL. The sample data that we are using is all shown Appendix B: Example data in on page 62. When we query our Products table, we also want to pull the appropriate data from the Types table for each record. To do this we ll use a JOIN, the syntax of which looks like this. SELECT <columns> FROM <table1> INNER JOIN <table2> ON <table1.column> = <table2.column> This syntax shows a JOIN between two tables, but you can add additional JOIN s if you need to join more than two tables. Let s put this into practice with our Products and Types tables. Run the following SQL query in MySQL Workbench. SELECT * FROM Products INNER JOIN Types ON Products.Type = Types.ID This query will pull all of the records in the Products table that have an associated record in the Types table. You will notice each record has both the product details, and the details for the associated type. Page 52

54 The JOIN we have just performed is an INNER JOIN (also known simply as a JOIN) which only returns records that have data in both tables. Page 53

55 You may have noticed in the results returned from our query that any products that have a NULL value for the Type column are not returned. This is because in an INNER JOIN a record has to exist in all tables being joined. A LEFT JOIN will return all results from the first table, regardless of whether there is a link to a record in the second table. The syntax for a LEFT JOIN is: SELECT <columns> FROM <table1> LEFT JOIN <table2> ON <table1.column> = <table2.column> Table 1 Table 2 For example: SELECT * FROM Products LEFT JOIN Types ON Products.Type = Types.ID Page 54

56 You may notice that when you run this example there are more records returned. This is because all records from the Products table (table 1) are returned, regardless of whether or not there is an associated record in the Types table (table 2). As a result, all of the products that have a NULL value in their Type column are also returned. Let s run another query, this time to return only certain fields from both tables. SELECT Products.ID, Products.Name, Types.Name, Types.Description FROM Products LEFT JOIN Types ON Products.Type = Types.ID WHERE Products.Available > '0' Here we specify the table before the fieldname, separating them with a full stop (.). This is particularly useful when you have tables with columns of the same name in your query (such as your ID columns). To shorten your queries you can give your tables an alias with the AS keyword. For example, in the queries above we can give our Products table the alias P and our types table the alias T. SELECT P.ID, P.Name, T.Name, T.Description FROM Products AS P LEFT JOIN Types AS T ON P.Type = T.ID WHERE P.Available > '0' Page 55

57 In this simple query example it makes very little difference, but it can make more complex queries easier and quicker to type. A RIGHT JOIN is similar to a LEFT JOIN, but is the other way around. All records from the second table are returned, whether they have an associated record in the first table or not. The syntax for a RIGHT JOIN is: SELECT <columns> FROM <table1> RIGHT JOIN <table2> ON <table1.column> = <table2.column> Table 1 Table 2 For example: SELECT * FROM Products RIGHT JOIN Types ON Products.Type = Types.ID If you run this query you will find that all records in the Types table will be displayed, and therefore only Products with an associated record. Page 56

58 At present our database does not allow us to sort our products into categories, a feature present in the majority (if not all) shopping websites. In order to do this, we will need to create another table, which we will call Categories. It needs to be possible for each product to belong to one or more categories. In the gardening example we are using, we might want a category for Bulbs, and one for each season. We might, therefore, categorise Tulips under both the Bulbs and Spring categories. Each category also needs to support multiple products. As a result, we will be creating a manyto-many relationship. Let s create another table to store our categories. We can then link each product to a category using a joining table. Open MySQL Workbench, double click on your database connection, and create a new table called Categories with the following columns. If you need guidance during the process you can refer back to Creating tables on page 10. Column name Datatype Flags ID INT PK (Primary Key), NN (Not Null), UN (Unsigned), AI (Auto-Increment) Name VARCHAR(45) NN (Not Null) Parent INT UN (Unsigned) Now add some data to the table. The categories we have created are shown in Appendix B: Example data on page 62. We now have a table for products, and a table for categories. However, at the moment there is nothing to link a product to a category or vice versa. Create another table, which will serve as a junction table to create a many-to-many link between the Products and the Categories tables. The junction table simply needs to contain the ID of the product and the ID of the category, so create a table called ProductCategory with the following columns. Page 57

59 Column name Datatype Flags ID INT PK (Primary Key), NN (Not Null), UN (Unsigned), AI (Auto-Increment) Product INT NN (Not Null), UN (Unsigned) Category INT NN (Not Null), UN (Unsigned) In this table we create a record to represent each link between a product and a category. The Product column contains the ID of the record in the Products table, and the Category field contains the ID of the category in the Categories table. For example, to link the first product to the fifth category, create the following record (you don t need to enter anything in the ID column; this is our Primary Key so MySQL will set this value automatically for you): ID Product Category Create some product-category relationships. You will need to look in the Products category, make a note of the corresponding ID number for your product, do the same for the category in the Categories table, and then enter the ID for each in a new record in the junction table. If you would like to use our sample data, it s all shown in Appendix B: Example data on page 62. Now that we have our sample data, let s create the JOIN. Because we are using three tables, instead of two, to create this many-to-many relationship we will need two JOIN s. First of all let s pull all of the records in the Products table, along with their associated record in the ProductCategory junction table. The Product column in our junction table contains the value of the corresponding ProductCategory record s ID column. As such, our query needs to join these two columns together. SELECT * FROM Products AS P INNER JOIN ProductCategory AS Junct ON P.ID = Junct.Product This query will pull out all of the records in the Products table that have an associated entry in the ProductCategory junction table. We are able to use the ProductCategory junction table to retrieve the associated record in the Categories table, but in order to do that we ll need to JOIN those two tables together. Page 58

60 SELECT * FROM Products AS P INNER JOIN ProductCategory AS Junct ON P.ID = Junct.Product INNER JOIN Categories AS C ON C.ID = Junct.Category In the second INNER JOIN we use the Category column in the ProductCategory junction table to link to the ID column in the Categories table. This query is not yet complete. At the moment it pulls all columns from all three tables, many of which are not necessary for our purposes. Let s specify only the fields we want to retrieve from this query. SELECT P.ID, P.Name, P.Description, P.Price, P.Available, C.Name FROM Products AS P INNER JOIN ProductCategory AS Junct ON P.ID = Junct.Product INNER JOIN Categories AS C ON C.ID = Junct.Category The first five columns of the returned results are all taken from the Products table, and the last is the name of the category in the Categories table. Finally, let s add a WHERE clause to only return products for which there is available stock. SELECT P.ID, P.Name, P.Description, P.Price, P.Available, C.Name FROM Products AS P INNER JOIN ProductCategory AS Junct ON P.ID = Junct.Product INNER JOIN Categories AS C ON C.ID = Junct.Category WHERE P.Available > '0' Page 59

Developing Web Applications for Microsoft SQL Server Databases - What you need to know

Developing Web Applications for Microsoft SQL Server Databases - What you need to know Developing Web Applications for Microsoft SQL Server Databases - What you need to know ATEC2008 Conference Session Description Alpha Five s web components simplify working with SQL databases, but what

More information

A Brief Introduction to MySQL

A Brief Introduction to MySQL A Brief Introduction to MySQL by Derek Schuurman Introduction to Databases A database is a structured collection of logically related data. One common type of database is the relational database, a term

More information

3.GETTING STARTED WITH ORACLE8i

3.GETTING STARTED WITH ORACLE8i Oracle For Beginners Page : 1 3.GETTING STARTED WITH ORACLE8i Creating a table Datatypes Displaying table definition using DESCRIBE Inserting rows into a table Selecting rows from a table Editing SQL buffer

More information

A table is a collection of related data entries and it consists of columns and rows.

A table is a collection of related data entries and it consists of columns and rows. CST 250 MySQL Notes (Source: www.w3schools.com) MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database objects called tables.

More information

Microsoft Access 3: Understanding and Creating Queries

Microsoft Access 3: Understanding and Creating Queries Microsoft Access 3: Understanding and Creating Queries In Access Level 2, we learned how to perform basic data retrievals by using Search & Replace functions and Sort & Filter functions. For more complex

More information

Creating Database Tables in Microsoft SQL Server

Creating Database Tables in Microsoft SQL Server Creating Database Tables in Microsoft SQL Server Microsoft SQL Server is a relational database server that stores and retrieves data for multi-user network-based applications. SQL Server databases are

More information

There are numerous ways to access monitors:

There are numerous ways to access monitors: Remote Monitors REMOTE MONITORS... 1 Overview... 1 Accessing Monitors... 1 Creating Monitors... 2 Monitor Wizard Options... 11 Editing the Monitor Configuration... 14 Status... 15 Location... 17 Alerting...

More information

Business Portal for Microsoft Dynamics GP 2010. User s Guide Release 5.1

Business Portal for Microsoft Dynamics GP 2010. User s Guide Release 5.1 Business Portal for Microsoft Dynamics GP 2010 User s Guide Release 5.1 Copyright Copyright 2011 Microsoft. All rights reserved. Limitation of liability This document is provided as-is. Information and

More information

DbSchema Tutorial with Introduction in SQL Databases

DbSchema Tutorial with Introduction in SQL Databases DbSchema Tutorial with Introduction in SQL Databases Contents Connect to the Database and Create First Tables... 2 Create Foreign Keys... 7 Create Indexes... 9 Generate Random Data... 11 Relational Data

More information

Microsoft Access Basics

Microsoft Access Basics Microsoft Access Basics 2006 ipic Development Group, LLC Authored by James D Ballotti Microsoft, Access, Excel, Word, and Office are registered trademarks of the Microsoft Corporation Version 1 - Revision

More information

Access Queries (Office 2003)

Access Queries (Office 2003) Access Queries (Office 2003) Technical Support Services Office of Information Technology, West Virginia University OIT Help Desk 293-4444 x 1 oit.wvu.edu/support/training/classmat/db/ Instructor: Kathy

More information

BulkSMS Text Messenger Product Manual

BulkSMS Text Messenger Product Manual BulkSMS Text Messenger Product Manual 1. Installing the software 1.1. Download the BulkSMS Text Messenger Go to www.bulksms.com and choose your country. process. Click on products on the top menu and select

More information

Customer Control Panel Manual

Customer Control Panel Manual Customer Control Panel Manual Contents Introduction... 2 Before you begin... 2 Logging in to the Control Panel... 2 Resetting your Control Panel password.... 3 Managing FTP... 4 FTP details for your website...

More information

Hypercosm. Studio. www.hypercosm.com

Hypercosm. Studio. www.hypercosm.com Hypercosm Studio www.hypercosm.com Hypercosm Studio Guide 3 Revision: November 2005 Copyright 2005 Hypercosm LLC All rights reserved. Hypercosm, OMAR, Hypercosm 3D Player, and Hypercosm Studio are trademarks

More information

Microsoft Access Lesson 5: Structured Query Language (SQL)

Microsoft Access Lesson 5: Structured Query Language (SQL) Microsoft Access Lesson 5: Structured Query Language (SQL) Structured Query Language (pronounced S.Q.L. or sequel ) is a standard computing language for retrieving information from and manipulating databases.

More information

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com Essential SQL 2 Essential SQL This bonus chapter is provided with Mastering Delphi 6. It is a basic introduction to SQL to accompany Chapter 14, Client/Server Programming. RDBMS packages are generally

More information

Customer admin guide. UC Management Centre

Customer admin guide. UC Management Centre Customer admin guide UC Management Centre June 2013 Contents 1. Introduction 1.1 Logging into the UC Management Centre 1.2 Language Options 1.3 Navigating Around the UC Management Centre 4 4 5 5 2. Customers

More information

Access 2007. Creating Databases - Fundamentals

Access 2007. Creating Databases - Fundamentals Access 2007 Creating Databases - Fundamentals Contents Database Design Objectives of database design 1 Process of database design 1 Creating a New Database... 3 Tables... 4 Creating a table in design view

More information

Introduction to Microsoft Jet SQL

Introduction to Microsoft Jet SQL Introduction to Microsoft Jet SQL Microsoft Jet SQL is a relational database language based on the SQL 1989 standard of the American Standards Institute (ANSI). Microsoft Jet SQL contains two kinds of

More information

SQL. Short introduction

SQL. Short introduction SQL Short introduction 1 Overview SQL, which stands for Structured Query Language, is used to communicate with a database. Through SQL one can create, manipulate, query and delete tables and contents.

More information

Access Tutorial 2: Tables

Access Tutorial 2: Tables Access Tutorial 2: Tables 2.1 Introduction: The importance of good table design Tables are where data in a database is stored; consequently, tables form the core of any database application. In addition

More information

Lab 9 Access PreLab Copy the prelab folder, Lab09 PreLab9_Access_intro

Lab 9 Access PreLab Copy the prelab folder, Lab09 PreLab9_Access_intro Lab 9 Access PreLab Copy the prelab folder, Lab09 PreLab9_Access_intro, to your M: drive. To do the second part of the prelab, you will need to have available a database from that folder. Creating a new

More information

Setting up a basic database in Access 2007

Setting up a basic database in Access 2007 Setting up a basic database in Access 2007 1. Open Access. This is the screen that you should see 2. Click on Blank database 3. Enter the name customer mailing list in the file name section (this will

More information

SES Project v 9.0 SES/CAESAR QUERY TOOL. Running and Editing Queries. PS Query

SES Project v 9.0 SES/CAESAR QUERY TOOL. Running and Editing Queries. PS Query SES Project v 9.0 SES/CAESAR QUERY TOOL Running and Editing Queries PS Query Table Of Contents I - Introduction to Query:... 3 PeopleSoft Query Overview:... 3 Query Terminology:... 3 Navigation to Query

More information

How to test and debug an ASP.NET application

How to test and debug an ASP.NET application Chapter 4 How to test and debug an ASP.NET application 113 4 How to test and debug an ASP.NET application If you ve done much programming, you know that testing and debugging are often the most difficult

More information

VP-ASP Shopping Cart Quick Start (Free Version) Guide Version 6.50 March 21 2007

VP-ASP Shopping Cart Quick Start (Free Version) Guide Version 6.50 March 21 2007 VP-ASP Shopping Cart Quick Start (Free Version) Guide Version 6.50 March 21 2007 Rocksalt International Pty Ltd support@vpasp.com www.vpasp.com Table of Contents 1 INTRODUCTION... 3 2 FEATURES... 4 3 WHAT

More information

Toad for Data Analysts, Tips n Tricks

Toad for Data Analysts, Tips n Tricks Toad for Data Analysts, Tips n Tricks or Things Everyone Should Know about TDA Just what is Toad for Data Analysts? Toad is a brand at Quest. We have several tools that have been built explicitly for developers

More information

Solutions e Selection wledg Kno.com ficedepot bsd.of

Solutions e Selection wledg Kno.com ficedepot bsd.of bsd.officedepot.com Knowledge Selection Solutions HOURS OF OPERATION E-COMMERCE TECHNICAL SUPPORT DESK OPERATIONAL HOURS DAYS OF WEEK Monday-Friday: HOURS (EASTERN TIME) 7:00 A.M. 8:30 P.M. (800) 269-6888

More information

MICROSOFT ACCESS STEP BY STEP GUIDE

MICROSOFT ACCESS STEP BY STEP GUIDE IGCSE ICT SECTION 11 DATA MANIPULATION MICROSOFT ACCESS STEP BY STEP GUIDE Mark Nicholls ICT Lounge P a g e 1 Contents Task 35 details Page 3 Opening a new Database. Page 4 Importing.csv file into the

More information

What will you find here?

What will you find here? Getting Started With PHPMagic PHPMagic is a Application Development (RAD) tool for generating advanced PHP applications that connect to and manage data of MySQL databases. It also generates PHP code for

More information

Business Portal for Microsoft Dynamics GP. Key Performance Indicators Release 10.0

Business Portal for Microsoft Dynamics GP. Key Performance Indicators Release 10.0 Business Portal for Microsoft Dynamics GP Key Performance Indicators Release 10.0 Copyright Copyright 2007 Microsoft Corporation. All rights reserved. Complying with all applicable copyright laws is the

More information

2Creating Reports: Basic Techniques. Chapter

2Creating Reports: Basic Techniques. Chapter 2Chapter 2Creating Reports: Chapter Basic Techniques Just as you must first determine the appropriate connection type before accessing your data, you will also want to determine the report type best suited

More information

Client Marketing: Sets

Client Marketing: Sets Client Marketing Client Marketing: Sets Purpose Client Marketing Sets are used for selecting clients from the client records based on certain criteria you designate. Once the clients are selected, you

More information

MS Access Lab 2. Topic: Tables

MS Access Lab 2. Topic: Tables MS Access Lab 2 Topic: Tables Summary Introduction: Tables, Start to build a new database Creating Tables: Datasheet View, Design View Working with Data: Sorting, Filtering Help on Tables Introduction

More information

Advanced Online Media Dr. Cindy Royal Texas State University - San Marcos School of Journalism and Mass Communication

Advanced Online Media Dr. Cindy Royal Texas State University - San Marcos School of Journalism and Mass Communication Advanced Online Media Dr. Cindy Royal Texas State University - San Marcos School of Journalism and Mass Communication Using SQLite Manager SQL or Structured Query Language is a powerful way to communicate

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

Introduction to SQL for Data Scientists

Introduction to SQL for Data Scientists Introduction to SQL for Data Scientists Ben O. Smith College of Business Administration University of Nebraska at Omaha Learning Objectives By the end of this document you will learn: 1. How to perform

More information

Online Blood Ordering System (OBOS)

Online Blood Ordering System (OBOS) Online Blood Ordering System (OBOS) This User Guide is applicable to OBOS versions numbered 6.0.x Author(s): Craig Wilkes / Wayne Minott Page 1 of 53 Table of Contents. Contents Page Introduction 3 Logging

More information

Decision Support AITS University Administration. Web Intelligence Rich Client 4.1 User Guide

Decision Support AITS University Administration. Web Intelligence Rich Client 4.1 User Guide Decision Support AITS University Administration Web Intelligence Rich Client 4.1 User Guide 2 P age Web Intelligence 4.1 User Guide Web Intelligence 4.1 User Guide Contents Getting Started in Web Intelligence

More information

There are several ways you can reduce the size of your mailbox, they include:

There are several ways you can reduce the size of your mailbox, they include: Managing Your Outlook Mailbox 1. Introduction Email quotas control the amount of email that can be stored in your Outlook mailbox on the FM Realty Email service. FM Realty users are issued an email quota

More information

Talk-101 User Guides Web Content Filter Administration

Talk-101 User Guides Web Content Filter Administration Talk-101 User Guides Web Content Filter Administration Contents Contents... 2 Accessing the Control Panel... 3 Proxy User Management... 4 Adding a new Proxy User... 5 Modifying an existing Proxy User...

More information

USB Recorder. User s Guide. Sold by: Toll Free: (877) 389-0000

USB Recorder. User s Guide. Sold by:  Toll Free: (877) 389-0000 USB Recorder User s Guide Sold by: http://www.twacomm.com Toll Free: (877) 389-0000 Table of Contents 1. Getting Started 1-1...First Login 1-2...Creating a New User 2. Administration 2-1...General Administration

More information

MYSQL DATABASE ACCESS WITH PHP

MYSQL DATABASE ACCESS WITH PHP MYSQL DATABASE ACCESS WITH PHP Fall 2009 CSCI 2910 Server Side Web Programming Typical web application interaction Database Server 3 tiered architecture Security in this interaction is critical Web Server

More information

Database Query 1: SQL Basics

Database Query 1: SQL Basics Database Query 1: SQL Basics CIS 3730 Designing and Managing Data J.G. Zheng Fall 2010 1 Overview Using Structured Query Language (SQL) to get the data you want from relational databases Learning basic

More information

Simple Invoicing Desktop Database with MS Access 2013. c 2015 by David W. Gerbing School of Business Administration Portland State University

Simple Invoicing Desktop Database with MS Access 2013. c 2015 by David W. Gerbing School of Business Administration Portland State University Simple Invoicing Desktop Database with MS Access 2013 c 2015 by David W. Gerbing School of Business Administration Portland State University July 2, 2015 CONTENTS 1 Contents 1 Create a New Database 1 2

More information

Using an Edline Gradebook. EGP Teacher Guide

Using an Edline Gradebook. EGP Teacher Guide Using an Edline Gradebook EGP Teacher Guide Table of Contents Introduction...3 Setup...3 Get the Gradebook Web Plugin... 3 Using Your Web Gradebook... 4 Using the Web Gradebook on a Shared Computer...

More information

AUTHENTICATION... 2 Step 1:Set up your LDAP server... 2 Step 2: Set up your username... 4 WRITEBACK REPORT... 8 Step 1: Table structures...

AUTHENTICATION... 2 Step 1:Set up your LDAP server... 2 Step 2: Set up your username... 4 WRITEBACK REPORT... 8 Step 1: Table structures... AUTHENTICATION... 2 Step 1:Set up your LDAP server... 2 Step 2: Set up your username... 4 WRITEBACK REPORT... 8 Step 1: Table structures... 8 Step 2: Import Tables into BI Admin.... 9 Step 3: Creating

More information

Once the schema has been designed, it can be implemented in the RDBMS.

Once the schema has been designed, it can be implemented in the RDBMS. 2. Creating a database Designing the database schema... 1 Representing Classes, Attributes and Objects... 2 Data types... 5 Additional constraints... 6 Choosing the right fields... 7 Implementing a table

More information

G563 Quantitative Paleontology. SQL databases. An introduction. Department of Geological Sciences Indiana University. (c) 2012, P.

G563 Quantitative Paleontology. SQL databases. An introduction. Department of Geological Sciences Indiana University. (c) 2012, P. SQL databases An introduction AMP: Apache, mysql, PHP This installations installs the Apache webserver, the PHP scripting language, and the mysql database on your computer: Apache: runs in the background

More information

Rochester Institute of Technology. Oracle Training: Preparing Journal Entries in the Oracle Applications

Rochester Institute of Technology. Oracle Training: Preparing Journal Entries in the Oracle Applications Rochester Institute of Technology Oracle Training: Preparing Journal Entries in the Oracle Applications 1 Table of Contents Introduction Lesson 1: Lesson 2: Lesson 3: Lesson 4: Lesson 5: Lesson 6: Logging

More information

CowCalf5. for Dummies. Quick Reference. D ate: 3/26 / 2 0 10

CowCalf5. for Dummies. Quick Reference. D ate: 3/26 / 2 0 10 CowCalf5 for Dummies Quick Reference D ate: 3/26 / 2 0 10 Page 2 Email: Support@COWCALF.COM Page 3 Table of Contents System Requirement and Installing CowCalf5 4 Creating a New Herd 5 Start Entering Records

More information

Web Intelligence User Guide

Web Intelligence User Guide Web Intelligence User Guide Office of Financial Management - Enterprise Reporting Services 4/11/2011 Table of Contents Chapter 1 - Overview... 1 Purpose... 1 Chapter 2 Logon Procedure... 3 Web Intelligence

More information

The Query Builder: The Swiss Army Knife of SAS Enterprise Guide

The Query Builder: The Swiss Army Knife of SAS Enterprise Guide Paper 1557-2014 The Query Builder: The Swiss Army Knife of SAS Enterprise Guide ABSTRACT Jennifer First-Kluge and Steven First, Systems Seminar Consultants, Inc. The SAS Enterprise Guide Query Builder

More information

SiteBuilder E-Shop User Guide

SiteBuilder E-Shop User Guide SiteBuilder E-Shop User Guide Contents What is eshop?... 3 Setting up eshop for the first time... 4 Setting up your ordering information... 4 Deciding how to process orders... 5 Setting your general configuration

More information

Infoview XIR3. User Guide. 1 of 20

Infoview XIR3. User Guide. 1 of 20 Infoview XIR3 User Guide 1 of 20 1. WHAT IS INFOVIEW?...3 2. LOGGING IN TO INFOVIEW...4 3. NAVIGATING THE INFOVIEW ENVIRONMENT...5 3.1. Home Page... 5 3.2. The Header Panel... 5 3.3. Workspace Panel...

More information

Deposit Direct. Getting Started Guide

Deposit Direct. Getting Started Guide Deposit Direct Getting Started Guide Table of Contents Before You Start... 3 Installing the Deposit Direct application for use with Microsoft Windows Vista... 4 Running Programs in Microsoft Windows Vista...

More information

ADVANCED OUTLOOK 2003

ADVANCED OUTLOOK 2003 ADVANCED OUTLOOK 2003 Table of Contents Page LESSON 1: MANAGING YOUR MAILBOX LIMITS...1 Understanding Mailbox Limits...1 Setting AutoArchive...3 AutoArchiving Your Folders...5 Deleting Items Automatically...7

More information

Setting Up Database Security with Access 97

Setting Up Database Security with Access 97 Setting Up Database Security with Access 97 The most flexible and extensive method of securing a database is called user-level security. This form of security is similar to methods used in most network

More information

Business Objects Version 5 : Introduction

Business Objects Version 5 : Introduction Business Objects Version 5 : Introduction Page 1 TABLE OF CONTENTS Introduction About Business Objects Changing Your Password Retrieving Pre-Defined Reports Formatting Your Report Using the Slice and Dice

More information

HE Gateway User guide for colleges and universities

HE Gateway User guide for colleges and universities HE Gateway User guide for colleges and universities HE Gateway 1 Student Loans Company Ltd Contents Section 1 Definitions & Related Documents...3 Definitions... 3 Related Documents... 3 Section 2 Purpose

More information

Creating QBE Queries in Microsoft SQL Server

Creating QBE Queries in Microsoft SQL Server Creating QBE Queries in Microsoft SQL Server When you ask SQL Server or any other DBMS (including Access) a question about the data in a database, the question is called a query. A query is simply a question

More information

BIGPOND ONLINE STORAGE USER GUIDE Issue 1.1.0-18 August 2005

BIGPOND ONLINE STORAGE USER GUIDE Issue 1.1.0-18 August 2005 BIGPOND ONLINE STORAGE USER GUIDE Issue 1.1.0-18 August 2005 PLEASE NOTE: The contents of this publication, and any associated documentation provided to you, must not be disclosed to any third party without

More information

Using Microsoft Access

Using Microsoft Access Using Microsoft Access Microsoft Access is a computer application used to create and work with databases. In computer jargon that means it s a Database Management System or DBMS. So what is a database?

More information

Unit 10: Microsoft Access Queries

Unit 10: Microsoft Access Queries Microsoft Access Queries Unit 10: Microsoft Access Queries Introduction Queries are a fundamental means of accessing and displaying data from tables. Queries used to view, update, and analyze data in different

More information

Advanced Query for Query Developers

Advanced Query for Query Developers for Developers This is a training guide to step you through the advanced functions of in NUFinancials. is an ad-hoc reporting tool that allows you to retrieve data that is stored in the NUFinancials application.

More information

SecureAssess Local. Install Guide. www.btl.com. Release 9.0

SecureAssess Local. Install Guide. www.btl.com. Release 9.0 SecureAssess Local Install Guide Release 9.0 Document 1.0 15.11.10 www.btl.com Disclaimer Whilst every effort has been made to ensure that the information and content within this user manual is accurate,

More information

Sitecore E-Commerce Cookbook

Sitecore E-Commerce Cookbook Sitecore E-Commerce Cookbook Rev: 2013-07-23 Sitecore E-Commerce Services 2.1 on CMS 7.0 Sitecore E-Commerce Cookbook A marketer's guide to Sitecore E-Commerce Services Sitecore E-Commerce Cookbook Table

More information

Setting Up ALERE with Client/Server Data

Setting Up ALERE with Client/Server Data Setting Up ALERE with Client/Server Data TIW Technology, Inc. November 2014 ALERE is a registered trademark of TIW Technology, Inc. The following are registered trademarks or trademarks: FoxPro, SQL Server,

More information

CSCI110 Exercise 4: Database - MySQL

CSCI110 Exercise 4: Database - MySQL CSCI110 Exercise 4: Database - MySQL The exercise This exercise is to be completed in the laboratory and your completed work is to be shown to the laboratory tutor. The work should be done in week-8 but

More information

PaymentNet Federal Card Solutions Cardholder FAQs

PaymentNet Federal Card Solutions Cardholder FAQs PaymentNet Federal Card Solutions It s easy to find the answers to your questions about PaymentNet! June 2014 Frequently Asked Questions First Time Login How do I obtain my login information?... 2 How

More information

Getting Started - The Control Panel

Getting Started - The Control Panel Table of Contents 1. Getting Started - the Control Panel Login Navigation Bar Domain Limits Domain User Account Properties Session Management 2. FTP Management Creating and Editing Users Accessing FTP

More information

General User/Technical Guide for Microsoft Access

General User/Technical Guide for Microsoft Access General User/Technical Guide for Microsoft Access School of Nursing University of Michigan This guide is the first step in understanding your database. See the list of documentation locations at the end

More information

Database Administration with MySQL

Database Administration with MySQL Database Administration with MySQL Suitable For: Database administrators and system administrators who need to manage MySQL based services. Prerequisites: Practical knowledge of SQL Some knowledge of relational

More information

McAfee Endpoint Encryption Reporting Tool

McAfee Endpoint Encryption Reporting Tool McAfee Endpoint Encryption Reporting Tool User Guide Version 5.2.13 McAfee, Inc. McAfee, Inc. 3965 Freedom Circle, Santa Clara, CA 95054, USA Tel: (+1) 888.847.8766 For more information regarding local

More information

MSSQL quick start guide

MSSQL quick start guide C u s t o m e r S u p p o r t MSSQL quick start guide This guide will help you: Add a MS SQL database to your account. Find your database. Add additional users. Set your user permissions Upload your database

More information

Jet Data Manager 2012 User Guide

Jet Data Manager 2012 User Guide Jet Data Manager 2012 User Guide Welcome This documentation provides descriptions of the concepts and features of the Jet Data Manager and how to use with them. With the Jet Data Manager you can transform

More information

My ø Business User guide

My ø Business User guide My ø Business User guide Contents Page 1 Contents Welcome to your My ø Business user guide. It s easy to use. Move your mouse over the page to get to the section you want. Click on the links at the top

More information

How to use MySQL Workbench and other development tools

How to use MySQL Workbench and other development tools 1 for Murach s MySQL (My Guitar Shop database) Chapter 2 How to use MySQL Workbench and other development tools Before you start the exercises Before you start these exercises, you need to install the

More information

B.1 Database Design and Definition

B.1 Database Design and Definition Appendix B Database Design B.1 Database Design and Definition Throughout the SQL chapter we connected to and queried the IMDB database. This database was set up by IMDB and available for us to use. But

More information

Results CRM 2012 User Manual

Results CRM 2012 User Manual Results CRM 2012 User Manual A Guide to Using Results CRM Standard, Results CRM Plus, & Results CRM Business Suite Table of Contents Installation Instructions... 1 Single User & Evaluation Installation

More information

Vodafone Bulk Text. User Guide. Copyright Notice. Copyright Phonovation Ltd

Vodafone Bulk Text. User Guide. Copyright Notice. Copyright Phonovation Ltd Vodafone Bulk Text User Guide Copyright Notice Copyright Phonovation Ltd Important Notice: The Information contained in this document is subject to change without notice and should not be construed as

More information

Filter by Selection button. Displays records by degree to which they match the selected record. Click to view advanced filtering options

Filter by Selection button. Displays records by degree to which they match the selected record. Click to view advanced filtering options The Home Ribbon Sort Buttons: sort records into ascending or descending order by selected field Filter by Selection button. Displays records by degree to which they match the selected record. Display summary

More information

ExpressShipper User Guide

ExpressShipper User Guide ExpressShipper Quick User Guide ExpressShipper Section 0 Page 1 of 1 Section 1: Structure of the User Guide In this section This section contains the following topics: Topic See Page What is the purpose

More information

Behavioral Health System

Behavioral Health System RESOURCE AND PATIENT MANAGEMENT SYSTEM Behavioral Health System (AMH) Version 4.0 Patch 6 Office of Information Technology Division of Information Technology Table of Contents 1.0 Objective #1: Introduction

More information

LAB 6: Code Generation with Visual Paradigm for UML and JDBC Integration

LAB 6: Code Generation with Visual Paradigm for UML and JDBC Integration LAB 6: Code Generation with Visual Paradigm for UML and JDBC Integration OBJECTIVES To understand the steps involved in Generating codes from UML Diagrams in Visual Paradigm for UML. Exposure to JDBC integration

More information

Structured Query Language. Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics

Structured Query Language. Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics Structured Query Language HANS- PETTER HALVORSEN, 2014.03.03 Faculty of Technology, Postboks 203,

More information

BID2WIN Workshop. Advanced Report Writing

BID2WIN Workshop. Advanced Report Writing BID2WIN Workshop Advanced Report Writing Please Note: Please feel free to take this workbook home with you! Electronic copies of all lab documentation are available for download at http://www.bid2win.com/userconf/2011/labs/

More information

INTER TRIBAL HEALTH AUTHORITY ELECTRONIC MEDICAL RECORD (EMR) CLERICAL TRAINING MANUAL

INTER TRIBAL HEALTH AUTHORITY ELECTRONIC MEDICAL RECORD (EMR) CLERICAL TRAINING MANUAL EMR CLINICAL TRAINING MANUAL INTER TRIBAL HEALTH AUTHORITY ELECTRONIC MEDICAL RECORD (EMR) CLERICAL TRAINING MANUAL PROFILE VERSION 7 July 1, 2014 TABLE OF CONTENTS Module 1: Sign On 1.1 Purpose 1.2 Icons

More information

Sample- for evaluation only. Introductory Access. TeachUcomp, Inc. A Presentation of TeachUcomp Incorporated. Copyright TeachUcomp, Inc.

Sample- for evaluation only. Introductory Access. TeachUcomp, Inc. A Presentation of TeachUcomp Incorporated. Copyright TeachUcomp, Inc. A Presentation of TeachUcomp Incorporated. Copyright TeachUcomp, Inc. 2010 Introductory Access TeachUcomp, Inc. it s all about you Copyright: Copyright 2010 by TeachUcomp, Inc. All rights reserved. This

More information

Table Of Contents. Welcome to Abebooks HomeBase Inventory Management Software version 2.3... 1. Quick Tour... 2. Toolbar... 2

Table Of Contents. Welcome to Abebooks HomeBase Inventory Management Software version 2.3... 1. Quick Tour... 2. Toolbar... 2 HomeBase 2.3 Table Of Contents Welcome to Abebooks HomeBase Inventory Management Software version 2.3... 1 Quick Tour... 2 Toolbar... 2 Navigating in Abebooks HomeBase... 3 Getting Started... 3 Loading

More information

Table of Contents. Introduction: 2. Settings: 6. Archive Email: 9. Search Email: 12. Browse Email: 16. Schedule Archiving: 18

Table of Contents. Introduction: 2. Settings: 6. Archive Email: 9. Search Email: 12. Browse Email: 16. Schedule Archiving: 18 MailSteward Manual Page 1 Table of Contents Introduction: 2 Settings: 6 Archive Email: 9 Search Email: 12 Browse Email: 16 Schedule Archiving: 18 Add, Search, & View Tags: 20 Set Rules for Tagging or Excluding:

More information

Getting Started guide

Getting Started guide Getting Started guide For centuries, key moments in our ancestors lives have been captured on fragile paper. The world s stories are disappearing too quickly. We ve been working to change that, but we

More information

Microsoft Outlook 2007 Introductory guide for staff

Microsoft Outlook 2007 Introductory guide for staff Platform: Windows PC Ref no: USER180 Date: 8 th January 2008 Version: 1 Authors: Julie Adams, Claire Napier Microsoft Outlook 2007 Introductory guide for staff This document provides an introduction to

More information

Query. Training and Participation Guide Financials 9.2

Query. Training and Participation Guide Financials 9.2 Query Training and Participation Guide Financials 9.2 Contents Overview... 4 Objectives... 5 Types of Queries... 6 Query Terminology... 6 Roles and Security... 7 Choosing a Reporting Tool... 8 Working

More information

Online shopping store

Online shopping store Online shopping store 1. Research projects: A physical shop can only serves the people locally. An online shopping store can resolve the geometrical boundary faced by the physical shop. It has other advantages,

More information

BUSINESS OBJECTS XI WEB INTELLIGENCE

BUSINESS OBJECTS XI WEB INTELLIGENCE BUSINESS OBJECTS XI WEB INTELLIGENCE SKW USER GUIDE (Skilled Knowledge Worker) North Carolina Community College Data Warehouse Last Saved: 3/31/10 9:40 AM Page 1 of 78 Contact Information Helpdesk If you

More information

Aspect Software Users Manual

Aspect Software Users Manual Aspect Software, Inc. Back-office software for restaurateurs Aspect Software Users Manual Support and General Contact Information Phone: 800.454.3280 or 405.721.4420 Fax: 405.721.4419 www.aspect-software.net

More information

Welcome to the topic on Master Data and Documents.

Welcome to the topic on Master Data and Documents. Welcome to the topic on Master Data and Documents. In this topic, we will look at master data in SAP Business One. After this session you will be able to view a customer record to explain the concept of

More information

Sendspace Wizard Desktop Tool Step-By-Step Guide

Sendspace Wizard Desktop Tool Step-By-Step Guide Sendspace Wizard Desktop Tool Step-By-Step Guide Copyright 2007 by sendspace.com This publication is designed to provide accurate and authoritative information for users of sendspace, the easy big file

More information