Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Articles Tagged ‘database’

Understand the basics of SQL database programming

Sunday, October 19th, 2014 by Servage
SQL lets you access and manipulate databases with ease and quickness. Therefore, understanding the basics of SQL database programming may make differences for you as a web developer, as you have to frequently encounter with various databases and SQL. Understanding SQL Database Web programmers understand that SQL (Structured Query Language) is vital to access and manipulate databases - since databases are an inevitable part of our modern web. Moreover, our personalization approaches tend to lead to more interactions with databases in highly complex manners. Therefore, learning the language that can drives our database programming is a must - and this post is a part of giving you a basic understanding of it. Here are some examples ...

Introduction to MySQL – Course 3/3

Sunday, August 17th, 2014 by Servage
mysqlinstallwinxp026Enter your password when prompted. You can then try the following command, which should result in something like the screen grab. SHOW databases; There may be other databases already created, and the test database may not be there. Bear in mind also that system administrators have ultimate control over everything and that you can encounter some unexpected setups. For example, you may find that you are required to preface all database names that you create with a unique identifying string to ensure that you do not conflict with databases created by other users. If you have any problems, have a word with your system administrator, who should be able to sort them out. Let ...

Introduction to MySQL – Course 2/3

Thursday, August 14th, 2014 by Servage
qqSo, to enter MySQL’s command-line interface, select Start→Run and enter CMD into the Run box, then press Return. This will call up a Windows Command prompt. From there, enter one of the following (making any appropriate changes as just discussed): "C:\Program Files\Zend\MySQL51\bin" -u root "C:\Program Files (x86)\Zend\MySQL51\bin" -u root Note the quotation marks surrounding the path and filename. These are present because the name contains spaces, which the Command prompt doesn’t correctly interpret; the quotation marks group the parts of the filename into a single string for the Command program to understand. This command tells MySQL to log you in as the user root, without a password. You will now be logged in to MySQL and ...

Introduction to MySQL – Step 1/3

Tuesday, August 12th, 2014 by Servage
mysql-databases With well over ten million installations, MySQL is probably the most popular database management system for web servers. Developed in the mid-1990s, it’s now a mature technology that powers many of today’s most-visited Internet destinations. One reason for its success must be the fact that, like PHP, it’s free to use. But it’s also extremely powerful and exceptionally fast—it can run on even the most basic of hardware, and it hardly puts a dent in system resources. MySQL is also highly scalable, which means that it can grow with your website. In fact, in a comparison of several databases by eWEEK, MySQL and Oracle tied for both best performance and greatest scalability. MySQL Basics A ...

MYSQL commands – Part 7

Friday, July 18th, 2014 by Servage
table_in_useRemoving a column You may also decide, upon reflection, that the page count column pages isn’t actually all that useful for this particular database, so here’s how to remove that column using the DROP keyword: ALTER TABLE classics DROP pages; Remember that DROP is irreversible. You should always use it with caution, because you could delete entire tables (and even databases) with it if you are not careful! Deleting a table Deleting a table is very easy indeed. But, because I don’t want you to have to re-enter all the data for the classics table, we won’t delete that one. Instead, let’s quickly create a new table, verify its existence, and then delete it by typing ...

MySQL Commands – Part 6

Wednesday, July 16th, 2014 by Servage
figure2Continued from part 5... The second line of each INSERT command contains the keyword VALUES followed by four strings within parentheses, separated by commas. This supplies MySQL with the four values to be inserted into the four columns previously specified. (As always, my choice of where to break the lines was arbitrary.) Each item of data will be inserted into the corresponding column, in a one-to-one correspondence. If you accidentally listed the columns in a different order from the data, the data would go into the wrong columns. The number of columns must match the number of data items. Renaming a table Renaming a table, like any other change to the structure or meta-information of ...

MySQL Commands – Part 5

Monday, July 14th, 2014 by Servage
qqAUTO_INCREMENT data type As its name implies, a column given this data type will set the value of its contents to that of the column entry in the previously inserted row, plus 1. This is your introduction to the ALTER command, which is very similar to CREATE. ALTER operates on an existing table, and can add, change, or delete columns. Our example adds a column named id with the following characteristics: INT UNSIGNED Makes the column take an integer large enough for you to store more than four billion records in the table. NOT NULL Ensures that every column has a value. Many programmers use NULL in a field to indicate that the field doesn’t have a value, but ...

MySQL Commands – Part 4

Monday, July 7th, 2014 by Servage
BM8T0Numeric data types MySQL supports various numeric data types, from a single byte up to double-precision floating-point numbers. Although the most memory that a numeric field can use up is eight bytes, you are well advised to choose the smallest data type that will adequately handle the largest value you expect. This will help keep your databases small and quickly accessible. To specify whether a data type is signed or unsigned, use the UNSIGNED qualifier. The following example creates a table called tablename with a field in it called fieldname of the data type UNSIGNED INTEGER: CREATE TABLE tablename (fieldname INT UNSIGNED); When creating a numeric field, you can also pass an optional number as ...

MySQL Commands – Part 3

Saturday, July 5th, 2014 by Servage
php-explorer-tab-search With this article we continue our series about essential MySQL Commands. Data Types (cont.) The year field, however, has more predictable values, so instead of VARCHAR we use the more efficient CHAR(4) data type. The parameter of 4 allows for four bytes of data, supporting all years from –999 to 9999. You could, of course, just store two-digit values for the year, but if your data is going to still be needed in the following century, or may otherwise wrap around, it will have to be sanitized first—much like the “millennium bug” that would have caused dates beginning on January 1, 2000, to be treated as 1900 on many of the world’s biggest ...

Using Database in Web Development – Part 10

Wednesday, July 2nd, 2014 by Servage
WPMYSQL-Cover Congratulations! You've finished the Database Basics tutorial. This tutorial should give you a good understanding of the fundamental concepts of adding, updating, retrieveing and deleting data using SQL. Anything Else? Remember, the skills that you have learned here are only the tip of the iceberg. There are many more concepts and helpful tools just waiting for you out there. The next best step in learning how to work with databases is to actually create one yourself. Take some time and investigate the databases that are available to you. If you are looking something simple to start you off I would suggest Microsoft Access. Access will provide you with a straight forward interface to design and ...