Database rodel arenas MSIT Databases are managed by
Database rodel arenas, MSIT
Databases • are managed by a database management system (DBMS) or database server • A server supports a database language to create and delete databases and to manage and search data
My. Sql Database • runs as a server (daemon) process or service • supports several different clients including a command-line interpreter • and a PHP function library • Can have more multiple database and each can hold different data organized in different ways
Database language • a set of statements that define and manipulate data. • After creating a database, the most common SQL statements used are INSERT, UPDATE, DELETE, and SELECT, which add, change, remove, and search data in a database, respectively.
Database
Database Table • A database table may have multiple attributes , each of which has a name • A table contains the data as rows • A row contains values for each attribute that together represent one related object.
Command Line Interpreter
Creating Database • The CREATE DATABASE statement creates a new, empty database without any tables or data. The following statement creates a database called winestore: mysql> CREATE DATABASE winestore; use winestore;
Table Name Constraint type name length Primary Key Creating Table
Deleting Databases & Tables • Drop is used to delete tables and databases DROP TABLE customer; DROP DATABASE winestore; • You can also use this : DROP DATABASE IF EXISTS winestore; CREATE DATABASE winestore; USE winestore;
Inserting data • Use the INSERT statement to add data in a row INSERT INTO customer VALUES (1, 'Williams', 'Lucy', 'E', 3, '272 Station St', 'Carlton North', 'VIC', '3054', 12, '(613)83008460', '2002 -0702');
Updating Data • You can use the following syntax for the UPDATE: UPDATE customer SET surname = 'Smith' WHERE cust_id = 7;
Deleting data • To select a specific data to be deleted, WHERE clause should be used DELETE FROM customer WHERE surname = 'Smith';
Querying • The SELECT statement is used to query and retrieve one or more rows from a database SELECT surname, firstname FROM customer;
- Slides: 14