Browsed by
Category: Blog

How to update info already in a table and Delete a row(s) from a table

How to update info already in a table and Delete a row(s) from a table

mysql> UPDATE [table name] SET Select_priv = ‘Y’,Insert_priv = ‘Y’,Update_priv = ‘Y’ where [field name] = ‘user’; mysql> DELETE from [table name] where [field name] = ‘whatever’; To update information already in a MySQL table, you can use the UPDATE statement. Here’s the syntax: sql UPDATE table_name SET column1 = value1, column2 = value2, … WHERE condition; This will update the values in the specified columns for the rows that meet the specified condition. To delete row(s) from a MySQL…

Read More Read More

How to Show certain selected rows with the value “pcds”

How to Show certain selected rows with the value “pcds”

mysql> SELECT * FROM tablename WHERE fieldname = “pcds”; To show certain selected rows with the value “pcds” in MySQL, you can use the SELECT statement with a WHERE clause. Here’s an example: sql SELECT * FROM your_table_name WHERE your_column_name = ‘pcds’; Replace your_table_name with the actual name of your table and your_column_name with the column where you want to find the value “pcds.” For instance, if you have a table named example_table and a column named example_column, the query…

Read More Read More

How to Update database permissions/privilages

How to Update database permissions/privilages

mysql> flush privileges; To update database permissions or privileges in MySQL, you typically use the GRANT and REVOKE statements. Here’s how you can do it: Granting Permissions: To grant permissions to a user, you can use the GRANT statement followed by the specific privileges and the database or tables the user should have access to. For example: sql GRANT SELECT, INSERT ON mydatabase.* TO ‘myuser’@’localhost’; This grants the SELECT and INSERT privileges on all tables in the mydatabase database to…

Read More Read More

How will Show all records containing the name “sonia” AND the phone number ‘9876543210’

How will Show all records containing the name “sonia” AND the phone number ‘9876543210’

mysql> SELECT * FROM tablename WHERE name = “sonia” AND phone_number = ‘9876543210’ To retrieve records containing the name “sonia” and the phone number ‘9876543210’ in MySQL, you can use the SELECT statement with the WHERE clause. Here’s an example query: sql SELECT * FROM your_table_name WHERE name = ‘sonia’ AND phone_number = ‘9876543210’; Make sure to replace your_table_name with the actual name of your table where the data is stored. This query will return all records where the name…

Read More Read More

Change column name and Make a unique column so we get nodupes

Change column name and Make a unique column so we get nodupes

mysql> alter table [table name] change [old column name] [new column name] varchar (50); mysql> alter table [table name] add unique ([column name]); To change the column name and make it unique in MySQL, you can use the ALTER TABLE statement. Assuming you want to change the column name from old_column to new_column and make it unique, you can execute the following SQL command: sql ALTER TABLE your_table CHANGE COLUMN old_column new_column datatype UNIQUE; Replace your_table with the name of…

Read More Read More

How to Show all records starting with the letters ‘sonia’ AND the phone number ‘9876543210’

How to Show all records starting with the letters ‘sonia’ AND the phone number ‘9876543210’

mysql> SELECT * FROM tablename WHERE name like “sonia%” AND phone_number = ‘9876543210’; To retrieve records in MySQL that start with the letters ‘sonia’ and have the phone number ‘9876543210’, you can use the SELECT statement with the LIKE operator for the name and a simple equality condition for the phone number. Here’s an example query: sql SELECT * FROM your_table_name WHERE name LIKE ‘sonia%’ AND phone_number = ‘9876543210’; Make sure to replace your_table_name with the actual name of your…

Read More Read More

How to make a column bigger and Delete unique from table

How to make a column bigger and Delete unique from table

mysql> alter table [table name] modify [column name] VARCHAR(3); mysql> alter table [table name] drop index [colmn name]; To make a column bigger in MySQL, you can use the ALTER TABLE statement along with the MODIFY COLUMN clause. Here’s an example: sql ALTER TABLE your_table_name MODIFY COLUMN your_column_name new_data_type; Replace your_table_name with the name of your table, your_column_name with the name of the column you want to modify, and new_data_type with the new data type and size you want to…

Read More Read More

Introduction to MySQL

Introduction to MySQL

Introduction Note: “MySQL” it third party (“sun micro system”) C:\mysql –u root Types of Table (Engine) MyISAM: Foreign key constraint does not support InnoDB: used to support foreign key constraint BDB: support for UNIX environment Heap: it is temporary or virtual table, which is created only in memory not in hard disk Merge: it is used, if we want to merge more than one table (it is also temporary or virtual table) Syntax: Create table list ( — , —…

Read More Read More