sql


  • (MySQL) MySQL doodles

    [sql] — Replace a word or string in a column UPDATE my_table SET my_column = REPLACE(my_column, ‘Old string’, ‘New string’); — [/sql]

  • Convert CSV to SQL

    This tool is fantastic! It saved me many hours of work, when I had complex CSV files I needed to turn into SQL tables http://www.convertcsv.com/csv-to-sql.htm

  • (PHP) Eloquent doodles for Laravel

    [php] // Get model by primary key $myModel = MyModel::find($id); //Where can use short syntax for equal comparison. $myModels = MyModel::where(‘someAttribute’, ‘=’, ‘someValue’)->get(); $myModels = MyModel::where(‘someAttribute’, ‘someValue’)->get(); // Delete models $affectedRows = MyModel::where(‘someAttribute’, ‘someValue’)->delete(); // Select distinct $distincts = MyModel::distinct()->select(‘someAttribute’)->where(‘someAttribute’, ‘someValue’)->get(); // Select with Limit and offset $myModels = MyModel::limit(30)->get(); $myModels = MyModel::limit(30)->offset(30)->get(); [/php] Different…