Showing entries 81 to 90 of 1180
« 10 Newer Entries | 10 Older Entries »
Displaying posts with tag: sql (reset)
MySQL Table DDL file with phpMyAdmin

If you need a structure only .sql file of a MySQL tables’ Data Definition Language (DDL), phpMyAdmin makes this super-easy with just a few clicks. Continue reading and learn how…

Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!

Why use a DDL file?

Why would you need a structure-only .sql DDL file anyway?

Maybe you want to build out a tables’ structure on another server to bring in different data or something comparable, and want it void of any existing data.

Rather than creating the …

[Read more]
Medium Cross Post – CodeIgniter 4 CRUD: Delete

When the time comes that you no longer have a need for specific data, use DELETE to remove it completely from your table. CodeIgniter 4 Models have a delete() method that is super-easy to use. Continue reading for more information…

Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!

CodeIgniter 4 CRUD Series with MySQL

I have written a now complete 4-part series over on my Medium account about CodeIgniter 4 Model CRUD operations. Feel free and visit any of the previous posts in the series to get up to speed:

[Read more]
MySQL SQL Filters

An interesting outcome of teaching SQL is discovering what skills new users require. One that I continuously rediscover is how to build a test case for various elements of SQL. This is a small article on querying with filters in the WHERE clause.

There are several of the exercises in Alan Beaulieu’s Learning SQL, 3rd Edition that would benefit from example setup. For example, Chapter 4 provides a snapshot of the payment table but doesn’t provide any instructions.

You can create an exercise_4_2 table with the following SQL statement if you plan to change the data:

CREATE TABLE exercise_4_2 AS
SELECT payment_id
,      customer_id
,      amount
,      payment_date
FROM   payment
WHERE  payment_id BETWEEN 101 AND 120;

Alternatively, you can create an exercise_4_2 view with the following SQL statement if you plan to only query the data:

CREATE VIEW exercise_4_2 AS
SELECT payment_id
, …
[Read more]
Medium Cross-post – CodeIgniter 4 CRUD: Update

In some applications, data may never change. Yet, in others, data changes numerous times in its lifecycle. In SQL the UPDATE command changes existing rows of data. CodeIgniter 4 Models have 2 methods available for update operations: update() and save(). Continue reading and learn more about update()

Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!

CodeIgniter 4 CRUD Series with MySQL

This post is a re-share of an article I originally published on my Medium account and is part 3 in the CodeIgniter 4 CRUD with MySQL series. Be sure and …

[Read more]
Medium Cross-post – CodeIgniter 4 CRUD: Read

Storing data is but one part of many in application development. Once data is stored, interested parties will likely want to see it. This is the Read aspect of CRUD – reading (or viewing) the data. Continue reading and see examples using CodeIgniter 4 built-in Model methods…

Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!

In part 1 of this series, CodeIgniter 4 CRUD with MySQL: Create, I used the Model insert() method to store new rows of data. Now that the data is present in the table, we want to see that data.

There are 2 built-in Model …

[Read more]
Medium Cross-post: CodeIgniter 4 CRUD – Create

I’m studying and beginning to use CodeIgniter 4 in ‘real-world‘ projects and want to share what I learn, as I pick up on concepts of the framework. I’m posting a series of CRUD-related posts over on Medium and resharing them here for any readers who are interested…

Are you a Medium member? If so, receive an email notification each time I publish a blog post if you prefer the Medium platform. Not a member? No worries! Use my sign-up link (I will get a commission at no extra cost to you) and join. I really enjoy reading all the great content there and I know you will too!!!

[Read more]
Title Case Anyone?

Sometimes life is too surreal. Like when somebody says, “How do you get title case in an Oracle database?” That’s when you know three things about the individual, while suppressing laughter. They’re not very experienced with SQL, likely lazy, and don’t read the documentation.

I had a little fun with somebody today by taking them down a small rat-hole. “Oh, gosh … ” I said, “… let’s write a function for that.” Here’s the joke function, like:

CREATE OR REPLACE
FUNCTION title_case
( string VARCHAR2 ) RETURN VARCHAR2 IS
BEGIN
  /* Change upper case to title case. */
  RETURN UPPER(SUBSTR(string,1,1)) || LOWER(SUBSTR(string,2,LENGTH(string)));
END title_case;
/

Then, we tested it with a query from the pseudo dual table:

SELECT title_case('incredible') AS "Proper Name" FROM dual;

It returned:

Proper Name
----------
Incredible

Then, I said “Oh, that’s not his …

[Read more]
MySQL PHP Transaction

My students liked the MySQL Transaction post but wanted one that showed how an external web application would interact with MySQL in the scope of a transaction. So, I put a little PHP function together that write across two related tables in the context of a transaction. It uses mysqli (MySQL Improved Extension) to connect PHP to the MySQL database.

The function is barebones and uses the oldest approach of hidden inputs to maintain context between rendered forms using an HTML POST method. The hidden inputs are preceded with “h_” and snake case is used for variable names.

The function only writes to two tables. It writes to the member table and when that completes successfully to the contact table. The function:

  • Submits credentials from a file and raises an error when they don’t work.
  • Initializes a …
[Read more]
MySQL BETWEEN Operator Queries – Are they inclusive?

I recently learned of some odd behavior using MySQL BETWEEN operator queries, filtering by a DATETIME column. I wrote about this over on Medium so I am sharing the post for any readers here who are interested…

Image by _Alicja_ from Pixabay 

Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit …

[Read more]
MySQL Outer Joins

The students needed yet another example of LEFT JOIN, RIGHT JOIN, and FULL JOIN syntax (by combining a left and right join with the UNION set operator). To that end, I put this set of examples together.

The example also shows how to order the result set from a derived table with the UNION operator. It uses the WITH clause to build a Common Table Expression (CTE), which allows the query to order the UNION set operator’s product based on the left and right join queries. It uses a CASE statement to order the result sets. The left_table is the parent table and the right_table is the child table in the relationship, which means the right_table holds a left_id foreign key column that lets you connect matching rows in the left_table.

You build the little model with the following …

[Read more]
Showing entries 81 to 90 of 1180
« 10 Newer Entries | 10 Older Entries »