Author

Topic: [MATUTO] MYSQL DATABASE at merit challenge. (Read 217 times)

sr. member
Activity: 1610
Merit: 264
April 14, 2021, 08:22:18 AM
#8
~
Challenge accepted, kabayan.
Eto ang aking mga kasagutan.

Pasabi na lang kung di maaari yung magpalit ng unti sa pangalan ng mga column at aking babaguhin kaagad. Binago ko lang sa kadahilanang nais ko ring matuto ng pagsubok ng pagiiba ng unti sa mga binigay ng challenge.

Quote
SELECT * FROM tbl_accounts WHERE account_id = 2



Quote
SELECT account_password FROM tbl_accounts WHERE account_username LIKE '%c%'



Quote
SELECT account_password FROM tbl_accounts WHERE account_password LIKE '%n'




Quote
SELECT account_username FROM tbl_accounts WHERE account_username LIKE '%a%'



Quote
SELECT account_password FROM tbl_accounts WHERE account_password LIKE '%2'


Quote
SELECT account_username FROM tbl_accounts WHERE account_username LIKE '%1'


Blank result sa ika anim dahil walang username na nagtatapos sa "1"


sr. member
Activity: 1162
Merit: 450
Napansin ko na wala din gaanong susubok ng mga ganitong kaadvance ng challenges dahil: Una, kelangan ng PC/Laptop para makapag run ng XAMPP at basic knowledge about sa mismong app na ito (hindi pwedeng ipadownload lang natin kasi yung iba pwedeng madownload nila eh may backdoor ang iiinstall nilang app); Ikalawa, knowing XAMPP and MySQL database wouldn't really be helpful kasi more on back-end database connection lang ito compared if the challenges would require just a simple thinking gaya nung ibang challenges mong related sa Discrete Mathematics. Lastly, Relational Database kadalasan ang gamit ng MySQL -- which is way complicated on both developers and kahit simpleng readers. Kaya ako personally preferred ko ang mga Document-oriented Database.

Good job sa onting knowledge about MySQL databases, pero kung gusto mo din newbie friendly and modern, try studying Document-oriented databases (PostgresQL or MongoDB). Ayon, aabangan ko magiging challenge mo doon!  Grin Grin
legendary
Activity: 1708
Merit: 1280
Top Crypto Casino
naumpisahan ko na 'to dati. more than half na yata ako. sayang di ko na n tapos. dami kasing distraction pag freelancer.

Maganda to gamitin buddy ilan sa mga mataas ang sweldo sa industry like Database administrator, lalo if gusto mo mag develop ng something can help para sa ating forum.

~~~

Isang karangalan na mag comment ang isa sa mga programmer ng forum. Tingin ko mag set nalang ako ng another question most of the answer ni bL4nkcode ay tama sana may mag participate pa na ibang member.
copper member
Activity: 2142
Merit: 1305
Limited in number. Limitless in potential.
Parang wala atang interesado dito ah, baka gusto mo OP ipatuloy ko Haha.

Ito mga output ko, paki check na lang kung tama na ba output ko

1.


2.


3.


4


5.


6.
member
Activity: 166
Merit: 15
naumpisahan ko na 'to dati. more than half na yata ako. sayang di ko na n tapos. dami kasing distraction pag freelancer.
legendary
Activity: 1708
Merit: 1280
Top Crypto Casino
Still too complicated to learn the backend pero salamat sa pagbabahagi, I guess i-bookmark ko lang muna ito. Still trying newbie sa frontend pero aasahan ko naman na darating din ako diyan. I think mas maganda na ilagay mo yung right links din sa mga application na ginamit mo sa tutorial na ito for security purposes na rin gaya ng XAMPP app, suggestion lang din.

They can access yung installer din dito mga kabayan kung tingin nyo magagamit nyo to laking tulong din ito lalo sa mga gusto mag benta ng website like wordpress and then may database. Also gusto ko sana ilagay dito ung installer ng version na gamit ko kaso baka maging issue. Pero dito maaccess nyo dito ung installer

Code:
https://dev.mysql.com/downloads/installer/
hero member
Activity: 2030
Merit: 578
No God or Kings, only BITCOIN.
Still too complicated to learn the backend pero salamat sa pagbabahagi, I guess i-bookmark ko lang muna ito. Still trying newbie sa frontend pero aasahan ko naman na darating din ako diyan. I think mas maganda na ilagay mo yung right links din sa mga application na ginamit mo sa tutorial na ito for security purposes na rin gaya ng XAMPP app, suggestion lang din.
legendary
Activity: 1708
Merit: 1280
Top Crypto Casino
Kung sa nakikita nyo sa bottom part ng forum ay gumagamit tayo ng MySQL kung san ginagamit ito for database. Ang MySQL ay isang open source database na maari mong gamitin para sa personal projects, business at iba pa.

Alam ko ang ilan sa inyo alam na ito pero ngayon mag bibigay ako ng basic knowledge regarding sa MySQL
If mag run kayo ng mysql ang unang makikita nyong panel na mag prompt ay ito para ma access ang database need mo start ang Apache at MySQL


Pumunta sa iyong web browser at i-type “localhost” and ito ang mag appear then click phpMyAdmin


Mag direct sya sa MySQL page kung saan ma access mo lahat ng database at pwede ka ding gumawa. Also you can import and export ng database


Para gumawa ng database click lick new > and type your database name at may ginawa na nga akong isa.


Also you can manually type sa SQL panel to create a database
Code:
create database db_demo2


Sabihin nating naka gawa na kayo ng database at ngayon ipapakita ko paano gumagana ang log in feature sa forum. Gumawa na ako ng table para sa users para ma store ang username at password.


Primary serves as the uniqueness of the table. Para madaling maintindihan. E.g ID number.




Also, you can increment the ID with the command na AUTO_INCREMENT
Code:
create table tbl_accounts(
account_id int(10) AUTO_INCREMENT
);

Code:
Result:
id
1 Peanuts1
2 Peanuts1
3 Peanuts1

So paano to gumagana, pag ang user nag lagay ng data tulad ng username at password vini-verify ito ni database if same ba ang output at naka direct kay developer if saan nya ito direct pero sa case natin sa forum direkta tayo sa home page ng bitcointalk

I made this on draw.io but now new domain
Code:
https://app.diagrams.net/


Ito ang ibat-ibang basic commands para sa MySQL Database.

Legends
* - means "all"/ lahat data or information

SELECT COMMAND – ginagamit para makita ng specific na data na gusto mo
SELECT * FROM [table name]
Syntax:

Output:


WHERE COMMAND – ginagamit para makita ang specific na data pero may condition.
SELECT [column name] FROM [table name] WHERE [condition]
Syntax:

Output:


LOGICAL OPERATORS COMMAND

AND - SELECT [column name] FROM [table name] WHERE [condition] AND [condition]
OR - SELECT [column name] FROM [table name] WHERE [condition] OR[condition]
NOT - SELECT [column name] FROM [table name] WHERE [condition] NOT IN [condition]

LIKE COMMAND - LIKE command is commonly used kung may gusto kang makita na similar letter or word. Madalas to ginagamit sa search features.

Note :
% - used for looking a data and neglect the number of the character after the letter chosen.
_ - used for a single character

SELECT [column name] FROM [table name] WHERE [condition] LIKE [pattern]
Syntax (%):

Output:


Syntax (_):

Output:



INSERT COMMAND - used if you want to insert a data
INSERT INTO [table name] (column name) VALUES (values1)

Syntax:

Output:







So ito may challenge ako para sa lahat open ito pero ang mga member rank below lang ang makaka receive ng merits para nadin makatulong sa kanila mag pa rank up 1:1 lang pag distribute ibig sabihin pag nanalo na is di na pwede sumali (still depends sa magiging takbo ng thread.) So mag bibigay ako ng syntax at gagawin lang ay dapat mabigay ang dapat ipalabas na output.



CHALLENGE #1
SELECT * FROM tbl_accounts WHERE account_id = 2

SELECT account_password FROM tbl_accounts WHERE account_username LIKE '%c%'

SELECT account_password FROM tbl_accounts WHERE account_password LIKE '%n'

SELECT account_username FROM tbl_accounts WHERE account_username LIKE '%a%'

SELECT account_password FROM tbl_accounts WHERE account_password LIKE '%2'

SELECT account_username FROM tbl_accounts WHERE account_username LIKE '%1'

Every time a member answered the given question a new set of question/query/command will be drop on this thread.


You can use these for more information
Code:
https://www.mysqltutorial.org/mysql-cheat-sheet.aspx
https://www.javatpoint.com/mysql-commands-cheat-sheet
https://www.w3schools.com/sql/default.asp

Jump to: