Skip to main content

Posts

Showing posts with the label MySQL

Join in MySQL

Join clause is used to combine rows from two or more tables depending upon common field between them. There are different kinds of Joins. The most common and useful Join is Inner Join. Inner Join: It will return all rows from multiple tables where the condition is met.

Aggregate Functions in MySQL

Aggregate Functions are those functions which are used in SQL. They return a single value which is calculated from values in the columns from a particular table. The aggregate functions are below: AVG()- It returns a average value COUNT() - It returns the number of rows in a table MAX() - It returns the maximum value stored in a table MIN() - It returns the minimum value stored in a table SUM() - It returns the sum of all the values of specified column

SubQuery in MySQL

A subquery is a query inside another query or it is a nested query which is embedded within the WHERE clause. Subqueries can be used with the SELECT, INSERT, UPDATE, and DELETE statements along with the operators like =, <, >, >=, <=, IN, BETWEEN etc.

Sorting, searching and pagination

Sorting: While retrieving information from database, you can sort information or data as per your requirement. Like in some case, if you want to show the latest entered value in the table then you can show data in descending order of primary key. Similarly you can also show data displayed according to the name in ascending or decending order. Use " ORDER BY " Keyword.

Normalization of Relational Database and its types

A database stores data in an organized way so that it can be searched and retrieved later. It should contain one or more tables. A table is much like a spreadsheet, in that it's made up of rows and columns. All rows have the same columns, and each column contains the data itself. If it helps, think of your tables in the same way that you would a table in Excel. Data can be inserted, retrieved, updated, and deleted from a table. The word, created, is generally used instead of inserted, so, collectively, these four functions are affectionately abbreviated as CRUD .

Uploading XML file into PHP

If you want to upload XML file into PHP, this tutorial will teach you first to make XML file and then mechanism to upload into your database using PHP. To Download full files, Click Here   First start with creating XML documents

Download XAMPP

XAMPP is a very easy to install Apache Distribution for Linux, Solaris, Windows and Mac OS X. The package includes the Apache web server, MySQL, PHP, Perl, a FTP server and phpMyAdmin. Download XAMPP from below locations: Download From Sourceforge Download From CNET Download From DownloadXamp

MySQL: SQL

SQL is a standard language for accessing and manipulating databases. To connect any and every database and to execute, insert, update or delete any records, we need SQL.. Brief description about SQL:     SQL stands for Structured Query Language     SQL lets you access and manipulate databases     SQL is an ANSI (American National Standards Institute) standard What Can SQL do?     SQL can execute queries against a database     SQL can retrieve data from a database     SQL can insert records in a database     SQL can update records in a database     SQL can delete records from a database     SQL can create new databases     SQL can create new tables in a database     SQL can create stored procedures in a database     SQL can create views in a database     SQL can set permissi...

MySQL Connection

Connection with MySQL Database Before accessing database, you must create a connection to the database Syntax: mysql_connect(servername,username,password); where, servername specifies the server to connect to. Default value is “localhost” username specifies the username to log in with. Default value is the name of the user that owns the server process. To connect offline we use username “root”. password specifies the password to log in with. Default is “” Code : Creating connection to the database and selecting the required database <?php $con = mysql_connect(“localhost”,”root”,”"); if (!$con) { die(‘Could not connect: ‘ . mysql_error()); } else{ mysql_select_db(“test”, $con) }; ?> Here, we have store connection in a variable called $con and trap error using die function. Closing connection The connection will be closed automatically when the script ends. To close the connection before, use the mysql_close() function: <?php $con = mysql_conne...

MySQL: Introduction

MySOL is a database. With PHP, default database is MySQL. Database is needed to create any dynamic website or web application. Records or information for any website is kept in database in the forms of tables. Table is the collection of related data entries and it consist of columns and rows. A row of information is called tuple. What is Query? Query is a question or a request. With the help of query you can show, add,edit and delete any record. How to create database? Its very simple, just open your database, create database as below: 1)Open link http://localhost/phpmyadmin. 2)Click on the database tab. 3)Give name of database and create like below.   now  I will inside the database called test as below: How to create tables? 1)Once you have created database, click on the database. For example, I have created a database called test. So  2) Create table on the database test. 3) Give table name and number of fields needed and click on c...